Skip to content

Commit 91686a1

Browse files
authored
Merge pull request #440 from datacamp/update-snowplow-tracking
Update Snowplow tracking
2 parents b27ec5f + 68272da commit 91686a1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

views/shared/_snowplow.ejs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
55
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
66
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
7-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d36fqcuygdrd4y.cloudfront.net/BuKMCyKUvvyXZkMi44LjI.js","snowplow"));
7+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//cdn.datacamp.com/sp/2.9.3.js","snowplow"));
88
9-
window.snowplow('newTracker', 'co', "<%- process.env.NODE_ENV === 'production' ? 'track.datacamp.com' : 'com-datacamp.mini.snplow.net' %>", {
9+
var options = {
1010
appId: 'rdocumentation',
1111
platform: 'web',
1212
post: true,
@@ -15,7 +15,14 @@
1515
webPage: true,
1616
performanceTiming: true
1717
}
18-
});
18+
};
19+
20+
<% if (process.env.NODE_ENV === 'production') { %>
21+
options.forceSecureTracker = true;
22+
options.postPath = '/spevent';
23+
<% } %>
24+
25+
window.snowplow('newTracker', 'co', "<%- process.env.NODE_ENV === 'production' ? 'www.datacamp.com' : 'com-datacamp.mini.snplow.net' %>", options);
1926
window.snowplow('enableActivityTracking', 10, 10); // Ping every 10 seconds after 10 seconds
2027
window.snowplow('enableLinkClickTracking');
2128

0 commit comments

Comments
 (0)