Categories
front-end

CJ Deep Linking with Google Analytics Outbound Link Tracking

One of our projects Hypeguide.com we use commission junction for our affiliate tracking. We also wanted to be able to track these in google analytics. The issue was that CJ dynamically appends data to the outbound url once you click it. In order for GA to be able to intercept that and fire an event we had to implement the code below.  Not the best but it does the job.

var externalAnchorEventTracker = [];
jQuery("a.product_type_external").on("click", function(event){
    externalAnchorEventTracker.push(event.type);
    var outboundlink = jQuery(this).attr("href");
    var linkContext = this;
    window.ga('send', 'event', 'outbound', 'click', outboundlink, {'hitCallback':
     function () {
        jQuery(linkContext).click();
	if (externalAnchorEventTracker.length == 1){
Some of the treating methods do not require any prescription cheap viagra in uk  and in some online kamagra shop you need to pay at the time of delivery. Dysfunctional engine reduces vehicle efficiency viagra uk  and uses more fuel for running. All Notes Reviewable Another huge benefit when making a decision to require these online Joshua's Law, is that each one of the notes in school discussion, are progressing to be reviewable for the time ordine cialis on line  that you simply have access to the web classes. Other ways of purging include using laxatives or maybe diuretics.  best tadalafil 		event.preventDefault();
	} else {
		externalAnchorEventTracker = [];
	}
     }
   });
});