Skip to content

Instantly share code, notes, and snippets.

@douglasgoodwin
Created May 21, 2013 17:26
Show Gist options
  • Save douglasgoodwin/5621578 to your computer and use it in GitHub Desktop.
Save douglasgoodwin/5621578 to your computer and use it in GitHub Desktop.
with Frank's tags
<!-- 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: '{{blogger.username}}'
};
this.snowplowTracker.trackImpression(this.options.BannerID, this.options.CampaignID, this.options.AdvertiserID, this.options.app_id);
this.snowplowTracker.enableLinkTracking();
this.evtData = {
// {{ title }} with {{campaign}} by {{sponsor}}
Category: "{{sponsor}}",
Action: "test Action",
Label: "{{campaign}}",
Property: "",
Value: "{{ title }}"
};
this.trackStructEvent();
},
trackStructEvent: function(){
this.snowplowTracker.trackStructEvent(this.evtData.Category, this.evtData.Action, this.evtData.Label, this.evtData.Property, this.evtData.Value);
},
pageLoad: function(){
this.evtData = {
Category: "{{BannerID}}", // The name you supply for the group of objects you want to track
Action: "{{CampaignID}}", // string which defines the type of user interaction for the web object
Label: "{{AdvertiserID}}", // optional string which identifies the specific object being actioned
Property: "{{blogger.username}}", // optional string describing the object or the action performed on it
Value: "" //
};
this.trackStructEvent();
},
ProductVideoEvent: function(){
this.evtData = {
Category: "media", // e.g. 'media', 'ecomm'
Action: "play-video", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "timeline", // e.g. quantity of an item added to basket
Value: 0.0 // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
TabWatchandsaveEvent: function(){
this.evtData = {
Category: "tab", // e.g. 'media', 'ecomm'
Action: "watch-and-save", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "", // e.g. quantity of an item added to basket
Value: "" // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
TabInnovationEvent: function(){
this.evtData = {
Category: "tab", // e.g. 'media', 'ecomm'
Action: "innovation", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "", // e.g. quantity of an item added to basket
Value: "" // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
TabReviewsEvent: function(){
this.evtData = {
Category: "tab", // e.g. 'media', 'ecomm'
Action: "twitter", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "hashtag", // e.g. quantity of an item added to basket
Value: "" // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
TabGenericEvent: function(){
this.evtData = {
Category: "tab", // e.g. 'media', 'ecomm'
Action: "generictab", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "tabid", // e.g. quantity of an item added to basket
Value: 0.0 // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
HotspotEvent: function(){
this.evtData = {
Category: "hotspot", // e.g. 'media', 'ecomm'
Action: "click", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}_DESCRIPTION", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "xy", // e.g. quantity of an item added to basket
Value: 0.0 // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
TabStorefinderEvent: function(){
this.evtData = {
Category: "tab", // e.g. 'media', 'ecomm'
Action: "storefinder", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "zipcode", // e.g. quantity of an item added to basket
Value: "" // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
VideoStartEvent: function(){
this.evtData = {
Category: "video", // e.g. 'media', 'ecomm'
Action: "start-video", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}_VIDEOID", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "timeline", // e.g. quantity of an item added to basket
Value: 0.0 // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
VideoEndEvent: function(){
this.evtData = {
Category: "video", // e.g. 'media', 'ecomm'
Action: "end-video", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}_VIDEOID", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "timeline", // e.g. quantity of an item added to basket
Value: 1.0 // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
ConversionEvent: function(){
this.evtData = {
Category: "conversion", // e.g. 'media', 'ecomm'
Action: "amazon", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}_RETAILERID", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "", // e.g. quantity of an item added to basket
Value: "" // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
},
CouponEvent: function(){
this.evtData = {
Category: "coupon", // e.g. 'media', 'ecomm'
Action: "watchandsave", // e.g. 'play-video', 'add-to-basket'
Label: "{{UserID}}_COUPONID", // e.g. ID of the video being played, or the SKU or the product added-to-basket
Property: "", // e.g. quantity of an item added to basket
Value: "" // e.g. price of an item added-to-basket, or the starting time of pressed video
};
this.trackStructEvent();
}
};
this.trackStructEvent();
}
// testEventTwo: function(){
// this.evtData = {
// Category: "testEventTwo Category",
// Action: "testEventTwo Action",
// Label: "testEventTwo Label",
// Property: "",
// Value: ""
// };
// this.trackStructEvent();
// }
};
var sp = new spTrackObj();
sp.initialize();
sp.pageLoad();
sp.ProductVideoEvent();
sp.TabWatchandsaveEvent();
sp.TabInnovationEvent();
sp.TabReviewsEvent();
sp.TabGenericEvent();
sp.HotspotEvent();
sp.TabStorefinderEvent();
sp.VideoStartEvent();
sp.VideoEndEvent();
sp.ConversionEvent();
sp.CouponEvent();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment