(function($) {
	"use strict";
	
	function trackVariationInterest() {
		$('a[data-mixpanel-variation]').on('click', function(e) {
			var $this = $(this);

			mixpanel.register_once({
		        "prefered variation name": $this.attr('data-mixpanel-variation')
		    });
			mixpanel.track("variation click", {
				"referrer": document.referrer, 
				"variation name": $this.attr('data-mixpanel-variation')
			}, function() {
				window.top.location = $this.attr('href')
			});

			e.preventDefault();
			return false;
		});
		$('a[data-mixpanel-purchase]').on('click', function(e) {
			var $this = $(this);

			mixpanel.track("purchase", $.extend(
				{
					"referrer": document.referrer, 
				}, $this.attr('data-mixpanel-variation') ? {
					"variation name": $this.attr('data-mixpanel-variation')
				} : {}
			), function() {
				window.top.location = $this.attr('href')
			});

			e.preventDefault();
			return false;
		});
		$('a[data-mixpanel-close]').on('click', function(e) {
			var $this = $(this);

			mixpanel.track("close", $.extend(
				{
					"referrer": document.referrer, 
				}, $this.attr('data-mixpanel-variation') ? {
					"variation name": $this.attr('data-mixpanel-variation')
				} : {}
			), function() {
				window.top.location = $this.attr('href')
			});

			e.preventDefault();
			return false;
		});
	}

	$(function() {
		trackVariationInterest();
	});
})(jQuery);

@@ -95,16 +95,91 @@
 ation%5D')
+%0A%09%09%09.not('a%5Bdata-mixpanel-purchase%5D')%0A%09%09%09.not('a%5Bdata-mixpanel-close%5D')%0A%09%09%09
 .on('cli
@@ -189,32 +189,33 @@
 , function(e) %7B%0A
+%09
 %09%09%09var $this = $
@@ -215,32 +215,33 @@
 his = $(this);%0A%0A
+%09
 %09%09%09mixpanel.regi
@@ -254,16 +254,17 @@
 nce(%7B%0A%09%09
+%09
         
@@ -334,16 +334,17 @@
 )%0A%09%09
+%09
     %7D);%0A
 %09%09%09m
@@ -339,16 +339,17 @@
     %7D);%0A
+%09
 %09%09%09mixpa
@@ -379,24 +379,25 @@
 ick%22, %7B%0A%09%09%09%09
+%09
 %22referrer%22: 
@@ -412,24 +412,25 @@
 .referrer, %0A
+%09
 %09%09%09%09%22variati
@@ -477,16 +477,17 @@
 ation')%0A
+%09
 %09%09%09%7D, fu
@@ -493,32 +493,33 @@
 unction() %7B%0A%09%09%09%09
+%09
 window.top.locat
@@ -538,37 +538,39 @@
 attr('href')%0A%09%09%09
+%09
 %7D);%0A%0A
+%09
 %09%09%09e.preventDefa
@@ -571,32 +571,33 @@
 ntDefault();%0A%09%09%09
+%09
 return false;%0A%09%09
@@ -586,32 +586,33 @@
 %09%09return false;%0A
+%09
 %09%09%7D);%0A%09%09$('a%5Bdat

fix issue with close and purchase triggering a variation event