Last active
January 3, 2016 10:59
-
-
Save hussainm/8453597 to your computer and use it in GitHub Desktop.
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 yourdomain1.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment