Skip to content

Instantly share code, notes, and snippets.

@douglasgoodwin
Created May 17, 2013 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglasgoodwin/5600461 to your computer and use it in GitHub Desktop.
Save douglasgoodwin/5600461 to your computer and use it in GitHub Desktop.
here's an example of the javascript that's generated from the secret URL.
<script
data-banner-css="/static/css/dashboard.min.css"
data-userid="3"
data-campaignid="7"
data-advertiserid="4"
data-bannerid="3"
data-userid="3"
data-main="/static/js/configDashboard"
data-json="/data/main.json"
src="/static/js/dashboard.js"
type="text/javascript"></script>
<!-- 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: 3,
CampaignID: 7,
AdvertiserID: 4,
app_id: ''
};
this.snowplowTracker.trackImpression(this.options.BannerID, this.options.CampaignID, this.options.AdvertiserID, this.options.app_id);
this.snowplowTracker.enableLinkTracking();
this.evtData = {
// with by
Category: "",
Action: "test Action",
Label: "",
Property: "",
Value: ""
};
this.trackStructEvent();
},
trackStructEvent: 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_4", // This is hacky!
Property: "timeline",
Value: 0.0
};
this.trackStructEvent();
},
ProductTab1Event: function(){
this.evtData = {
Category: "tab",
Action: "twitter",
Label: "twitter_4", // This is hacky!
Property: "",
Value: ""
};
this.trackStructEvent();
},
ProductTab2Event: function(){
this.evtData = {
Category: "tab",
Action: "video",
Label: "video_4", // This is hacky!
Property: "",
Value: ""
};
this.trackStructEvent();
},
ProductTab3Event: function(){
this.evtData = {
Category: "tab",
Action: "stores",
Label: "stores_4", // This is hacky!
Property: "",
Value: ""
};
this.trackStructEvent();
}
};
var sp = new spTrackObj();
sp.initialize();
sp.ProductVideoEvent();
sp.ProductTab1Event();
sp.ProductTab2Event();
sp.ProductTab3Event();
//sp.testEventTwo();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment