Skip to content

Commit 7383d86

Browse files
Merge pull request DataDog#687 from anagio/addSnowplowjs
add snowplow pixel
2 parents f6affc3 + 10614a2 commit 7383d86

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

layouts/_footer.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@
1010
<%= adroll_pixel() %>
1111
<% end %>
1212

13+
<%= snowplow_pixel() %>
14+
1315

1416

lib/default.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,28 @@ def adroll_pixel()
9191

9292
return html
9393
end
94+
95+
def snowplow_pixel()
96+
html = <<-EOF
97+
<script type="text/javascript">
98+
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
99+
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
100+
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
101+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://d33tyra1llx9zy.cloudfront.net/static/js/plow232.js","snowplow"));
102+
window.snowplow('newTracker', 'co', 'collector.datadoghq.com', { // Initialise a tracker
103+
appId: 'datadog', // Application ID. Make sure you use the same value across all the tags you fire on your trial
104+
platform: 'web',
105+
cookieDomain: '.datadoghq.com',
106+
contexts: {
107+
performanceTiming: true,
108+
webPage: true
109+
}
110+
});
111+
window.snowplow('enableActivityTracking', 5, 5); // Ping every 30 seconds after 30 seconds
112+
window.snowplow('enableLinkClickTracking');
113+
window.snowplow('trackPageView');
114+
</script>
115+
EOF
116+
117+
return html
118+
end

0 commit comments

Comments
 (0)