Created
May 17, 2013 04:04
-
-
Save douglasgoodwin/5596863 to your computer and use it in GitHub Desktop.
snowplow
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
<!-- Snowplow starts plowing --> | |
<script type="text/javascript"> | |
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.11.2/sp.js'; | |
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E")); | |
</script> | |
<script type="text/javascript"> | |
var spTrackObj = function(){}; | |
spTrackObj.prototype ={ | |
initialize: function(){ | |
var self = this; | |
this.snowplowTracker = SnowPlow.getTrackerCf('d3da8gtxngrv8u'); | |
//snowplowTracker.trackPageView(); | |
this.options = { | |
BannerID: {{BannerID}}, | |
CampaignID: {{CampaignID}}, | |
AdvertiserID: {{AdvertiserID}}, | |
App_ID: {{UserID}} | |
}; | |
this.snowplowTracker.trackImpression(this.options.BannerID, this.options.CampaignID, this.options.AdvertiserID, this.options.UserID); | |
this.snowplowTracker.enableLinkTracking(); | |
this.evtData = { | |
// {{ title }} with {{campaign}} by {{sponsor}} | |
Category: "{{sponsor}}", | |
Action: "test Action", | |
Label: "{{campaign}}", | |
Property: "", | |
Value: "{{ title }}" | |
}; | |
this.trackEvent(); | |
}, | |
trackEvent: function(){ | |
this.snowplowTracker.trackStructEvent(this.evtData.Category, this.evtData.Action, this.evtData.Label, this.evtData.Property, this.evtData.Value); | |
}, | |
ProductVideoEvent: function(){ | |
this.evtData = { | |
Category: "media", | |
Action: "play-video", | |
Label: "video_{{UserID}}", // This is hacky! | |
Property: "timeline", | |
Value: "0.0" | |
}; | |
this.trackEvent(); | |
}, | |
ProductTab1Event: function(){ | |
this.evtData = { | |
Category: "tab", | |
Action: "twitter", | |
Label: "twitter_{{UserID}}", // This is hacky! | |
Property: "", | |
Value: "" | |
}; | |
this.trackEvent(); | |
}, | |
ProductTab2Event: function(){ | |
this.evtData = { | |
Category: "tab", | |
Action: "video", | |
Label: "video_{{UserID}}", // This is hacky! | |
Property: "", | |
Value: "" | |
}; | |
this.trackEvent(); | |
}, | |
ProductTab3Event: function(){ | |
this.evtData = { | |
Category: "tab", | |
Action: "stores", | |
Label: "stores_{{UserID}}", // This is hacky! | |
Property: "", | |
Value: "" | |
}; | |
this.trackEvent(); | |
} | |
// testEventTwo: function(){ | |
// this.evtData = { | |
// Category: "testEventTwo Category", | |
// Action: "testEventTwo Action", | |
// Label: "testEventTwo Label", | |
// Property: "", | |
// Value: "" | |
// }; | |
// this.trackEvent(); | |
// } | |
}; | |
var sp = new spTrackObj(); | |
sp.initialize(); | |
sp.ProductVideoEvent(); | |
sp.ProductTab1Event(); | |
sp.ProductTab2Event(); | |
sp.ProductTab3Event(); | |
//sp.testEventTwo(); | |
</script> | |
<script | |
data-banner-css="/static/css/dashboard.min.css" | |
data-main="/static/js/configDashboard" | |
data-json="/data/main.json" | |
src="/static/js/dashboard.js" | |
type="text/javascript"></script> | |
<script type="text/javascript" src="/static/js/gist-embed.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment