Last active
December 31, 2015 01:58
-
-
Save raorao/7917168 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
</head> | |
<body> | |
<script src="jquery.js" type=text/javascript></script> | |
<script type=text/javascript> | |
$(document).ready(function() { | |
addKISSmetricsToButtons(); | |
}) | |
// configuration stuff. Once the website is loaded, the function AddKISSMetricsToButtons will run. | |
function addKISSmetricsToButtons() { | |
$('.template-button').click(function() { | |
var buttonId = this.id; | |
//this will find the unique Id of each campaign. When campaign one is clicked, buttonId will be set to 'campaign-one'. | |
_kmq.push(['record', 'template button clicked',{'campaign name': buttonId}]); | |
//_kmq.push takes three arguments -- 'record', the name of the event being triggered, | |
// and an optional hash of properties that will also be set. | |
// in this case, we're setting the property 'campaign name' to the given button's Id. | |
// notice that we've hardcoded the event name. This is best practice. You should never be dynamically creating event names | |
// since there is a hard limit on the number of events your account can have. | |
// We don't recommend creating multiple events in this situation. However, if you wanted to do that | |
// to preserve the exact funnel reports you currently have, you would have to do so in | |
// in a separate _kmq.push call. | |
}) | |
} | |
</script> | |
<div id="the-actual-website"> | |
<div class='template-button' id="campaign-one"> <!-- all the stuff related to campaign one --></div> | |
<div class='template-button' id="campaign-two"> <!-- all the stuff related to campaign two --></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment