KISSmetrics track visits to each domain separately

Have KISSmetrics installed on multiple domains? Want to see visits and conversion rate for each domain? Now you can this script fires an event whenever a user visits one of your domains. Will showup in KM as an event: Visited blog.yourdomain1.com Visited yourdomain2.com and so on…

// Segment Visitors by hostname
  jQuery(document).ready(function(){
    var refKm = document.referrer;
    var hostKm = document.location.hostname;
  
    // checks if visitor is from a different referrer
    if((hostKm.length > refKm.length && hostKm.indexOf(refKm) === -1) ||
      refKm.indexOf(hostKm) === -1)
      {
        _kmq.push(['record', 'Visited '+ hostKm]);
      }
  });

This comes in handy when you want to see stats for each domain separately or want to calculate conversion rate for visitors who have visited a particular site area. For example comonversion rate for people who visited blog.

Remember more granularity always comes in handy :).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.