Skip to content

Commit f3b479d

Browse files
Paul Boocockpaulboocock
authored andcommitted
Use local sp.js for example pages (close #790)
1 parent 4d3afc1 commit f3b479d

File tree

7 files changed

+45
-23
lines changed

7 files changed

+45
-23
lines changed

examples/ads/async.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
3838
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
3939
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
4040
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
41-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","adTracker"));
41+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","adTracker"));
4242

43-
window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
43+
window.adTracker('newTracker', rnd, '<<MY_COLLECTOR_URL>>', {
4444
'encodeBase64': false
4545
});
4646

@@ -110,9 +110,9 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
110110
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
111111
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
112112
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
113-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","adTracker"));
113+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","adTracker"));
114114

115-
window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
115+
window.adTracker('newTracker', rnd, '<<MY_COLLECTOR_URL>>', {
116116
'encodeBase64': false
117117
});
118118

@@ -141,9 +141,9 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
141141
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
142142
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
143143
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
144-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","adTracker"));
144+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","adTracker"));
145145

146-
window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
146+
window.adTracker('newTracker', rnd, '<<MY_COLLECTOR_URL>>', {
147147
'encodeBase64': false
148148
});
149149

examples/sp.js

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/web/activity-tracking.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
4444
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
4545
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
46-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.12.0/sp.js","snowplow"));
46+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","snowplow"));
4747

48-
window.snowplow('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
48+
window.snowplow('newTracker', 'sp', '<<MY_COLLECTOR_URL>>', { // Initialise a tracker
4949
// Initialise a tracker
5050
encodeBase64: false, // Default is true
51-
appId: 'CFe23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account
52-
platform: 'mob',
51+
appId: 'e23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account
52+
platform: 'web',
5353
contexts: {
5454
webPage: true,
5555
},

examples/web/async-large.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
2424
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
2525
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
26-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","snowplow_1"));
26+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","snowplow_1"));
2727

28-
window.snowplow_1('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
28+
window.snowplow_1('newTracker', 'cf', '<<MY_COLLECTOR_URL>>', { // Initialise a tracker
2929
encodeBase64: false, // Default is true
3030
appId: 'CFe23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account
3131
platform: 'mob',
@@ -83,9 +83,9 @@
8383
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
8484
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
8585
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
86-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","snowplow_2"));
86+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","snowplow_2"));
8787

88-
window.snowplow_2('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
88+
window.snowplow_2('newTracker', 'cf', '<<MY_COLLECTOR_URL>>', { // Initialise a tracker
8989
encodeBase64: false, // Default is true
9090
appId: 'CFe23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account
9191
platform: 'mob',

examples/web/async-medium.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
2525
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
2626
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
27-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","new_name_here"));
27+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","new_name_here"));
2828

29-
window.new_name_here('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', {
29+
window.new_name_here('newTracker', 'cf', '<<MY_COLLECTOR_URL>>', {
3030
encodeBase64: false,
3131
appId: 'CFe23a',
3232
platform: 'mob',

examples/web/async-small.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
2424
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
2525
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
26-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","snowplow"));
26+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","../sp.js","snowplow"));
2727

28-
window.snowplow('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
28+
window.snowplow('newTracker', 'cf', '<<MY_COLLECTOR_URL>>', { // Initialise a tracker
2929
encodeBase64: false, // Default is true
3030
appId: 'CFe23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account
3131
platform: 'mob',

examples/web/sync.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,16 @@
1919

2020
<!-- Snowplow starts plowing -->
2121
<script type="text/javascript">
22-
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js';
23-
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
22+
document.write(unescape("%3Cscript src='../sp.js' type='text/javascript'%3E%3C/script%3E"));
2423
</script>
2524
<script type="text/javascript">
2625
try {
2726
var snowplowTracker = Snowplow.getTrackerCf('d3rkrsqld9gmqf');
28-
snowplowTracker.enableLinkTracking();
29-
// snowplowTracker.enableActivityTracking(10, 10); Doesn't work yet, see https://github.com/snowplow/snowplow/issues/233
27+
snowplowTracker.enableLinkClickTracking();
28+
snowplowTracker.enableActivityTracking(10, 10);
3029
snowplowTracker.encodeBase64(false); // Default is true
3130
snowplowTracker.trackPageView();
32-
} catch ( err ) {}
31+
} catch ( err ) { }
3332
</script>
3433
<!-- Snowplow stops plowing -->
3534

0 commit comments

Comments
 (0)