-
Notifications
You must be signed in to change notification settings - Fork 3
/
wordpress_sp_script.js
34 lines (33 loc) · 1.28 KB
/
wordpress_sp_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// <!-- Snowplow starts plowing - Wordpress vE.2.14.0 -->
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://www2.gov.bc.ca/StaticWebResources/static/sp/sp-2-14-0.js","snowplow"));
var collector = 'spm.apps.gov.bc.ca';
window.snowplow('newTracker','rt',collector, {
appId: "Snowplow_engage",
cookieLifetime: 86400 * 548,
platform: 'web',
post: true,
forceSecureTracker: true,
contexts: {
webPage: true,
performanceTiming: true
}
});
window.snowplow('enableActivityTracking', 30, 30); // Ping every 30 seconds after 30 seconds
window.snowplow('enableLinkClickTracking');
window.snowplow('trackPageView');
window.snowplow('trackSiteSearch',
getUrlParamArray('s','')
);
function getUrlParamArray(param, defaultValue) {
var vars = [];
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
if ( key === param ) {
vars.push(value);
}
});
return vars;
}
// <!-- Snowplow stops plowing -->