From 2b54d78d19ec566a57ca9e30787aef01d682697a Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Fri, 26 Jun 2015 14:59:45 +0100 Subject: [PATCH 01/13] Bumped version to 2.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 734a1c316..c9f5b6203 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "snowplow-tracker", - "version": "2.4.3", + "version": "2.5.0", "devDependencies": { "JSON": "~1.0.0", "browser-cookie-lite": "~0.3.1", From 202427d69b077eb50b806c59cbf0360b95aa677c Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Tue, 30 Jun 2015 09:58:40 +0100 Subject: [PATCH 02/13] Added Grunt task to build the tracker skipping the lodash and minification tasks (closes #382) --- Gruntfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Gruntfile.js b/Gruntfile.js index c5a2b2d3f..63a361dbc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -259,6 +259,7 @@ module.exports = function(grunt) { grunt.registerTask('default', 'Build lodash, Browserify, add banner, and minify', ['lodash', 'browserify:main', 'concat:deploy', 'min:deploy']); grunt.registerTask('publish', 'Upload to S3 and invalidate Cloudfront (full semantic version only)', ['upload_setup', 'lodash', 'browserify:main', 'concat:deploy', 'min:deploy', 's3:not_pinned', 'cloudfront:not_pinned']); grunt.registerTask('publish-pinned', 'Upload to S3 and invalidate Cloudfront (full semantic version and semantic major version)', ['upload_setup', 'lodash', 'browserify:main', 'concat:deploy', 'min:deploy', 's3', 'cloudfront']); + grunt.registerTask('quick', 'Build snowplow.js, skipping building lodash and minifying', ['browserify:main', 'concat:deploy']); grunt.registerTask('test', 'Intern tests', ['browserify:test', 'intern']); grunt.registerTask('travis', 'Intern tests for Travis CI', ['lodash','concat:test', 'browserify:test','intern']); grunt.registerTask('tags', 'Minifiy the Snowplow invocation tag', ['min:tag', 'concat:tag']); From 59702576c715f89e88e6cb774e4c8864b9086723 Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Fri, 26 Jun 2015 16:56:15 +0100 Subject: [PATCH 03/13] Removed deprecated performanceTiming argument to trackPageView (closes #375) --- src/js/tracker.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/js/tracker.js b/src/js/tracker.js index e87f85e90..38c9dc200 100644 --- a/src/js/tracker.js +++ b/src/js/tracker.js @@ -1359,15 +1359,9 @@ * Log visit to this page * * @param string customTitle - * @param boolean DEPRECATED performanceTiming * @param object Custom context relating to the event */ - trackPageView: function (customTitle, performanceTiming, context) { - if (performanceTiming !== true && performanceTiming !== false) { - context = context || performanceTiming; - } else { - helpers.warn('The performanceTiming argument to trackPageView is deprecated. Instead use the "contexts" field in the argmap argument of newTracker.'); - } + trackPageView: function (customTitle, context) { trackCallback(function () { logPageView(customTitle, context); }); From d5c66fea8757c44ffa6900e962f78607d9e069e2 Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Fri, 26 Jun 2015 15:36:45 +0100 Subject: [PATCH 04/13] Added ability to pass a context-generating function to trackPageView (closes #372) --- src/js/tracker.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/js/tracker.js b/src/js/tracker.js index 38c9dc200..9e46f3000 100644 --- a/src/js/tracker.js +++ b/src/js/tracker.js @@ -777,13 +777,24 @@ }; } + /** + * Combine an array of unchanging contexts with the result of a context-creating function + * + * @param object staticContexts Array of custom contexts + * @param object contextCallback Function returning an array of contexts + */ + function finalizeContexts(staticContexts, contextCallback) { + return (staticContexts || []).concat(contextCallback ? contextCallback() : []); + } + /** * Log the page view / visit * * @param string customTitle The user-defined page title to attach to this page view * @param object context Custom context relating to the event + * @param object contextCallback Function returning an array of contexts */ - function logPageView(customTitle, context) { + function logPageView(customTitle, context, contextCallback) { // Fixup page title. We'll pass this to logPagePing too. var pageTitle = helpers.fixupTitle(customTitle || configTitle); @@ -791,7 +802,11 @@ refreshUrl(); // Log page view - core.trackPageView(purify(configCustomUrl || locationHrefAlias), pageTitle, purify(customReferrer || configReferrerUrl), addCommonContexts(context)); + core.trackPageView( + purify(configCustomUrl || locationHrefAlias), + pageTitle, + purify(customReferrer || configReferrerUrl), + addCommonContexts(finalizeContexts(context, contextCallback))); // Send ping (to log that user has stayed on page) var now = new Date(); @@ -827,7 +842,7 @@ if ((lastActivityTime + configHeartBeatTimer) > now.getTime()) { // Send ping if minimum visit time has elapsed if (configMinimumVisitTime < now.getTime()) { - logPagePing(pageTitle, context); // Grab the min/max globals + logPagePing(pageTitle, finalizeContexts(context, contextCallback)); // Grab the min/max globals } } }, configHeartBeatTimer); @@ -1360,10 +1375,11 @@ * * @param string customTitle * @param object Custom context relating to the event + * @param object contextCallback Function returning an array of contexts */ - trackPageView: function (customTitle, context) { + trackPageView: function (customTitle, context, contextCallback) { trackCallback(function () { - logPageView(customTitle, context); + logPageView(customTitle, context, contextCallback); }); }, From e2191abee259b58ffd188f33cb743d06ae17b07f Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Fri, 26 Jun 2015 16:06:19 +0100 Subject: [PATCH 05/13] Added a page view UUID (closes #369) --- package.json | 3 ++- src/js/in_queue.js | 7 +++++-- src/js/tracker.js | 22 +++++++++++++++++++++- tests/nonfunctional/in_queue.js | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c9f5b6203..91ec7831f 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "murmurhash": "0.0.2", "semver": "~2.2.1", "sha1": "git://github.com/pvorb/node-sha1.git#v1.0.0", - "snowplow-tracker-core": "0.3.0" + "snowplow-tracker-core": "0.3.0", + "uuid": "^2.0.1" }, "contributors": [ "Alex Dean", diff --git a/src/js/in_queue.js b/src/js/in_queue.js index 883dfb4c7..da0e9f9ee 100644 --- a/src/js/in_queue.js +++ b/src/js/in_queue.js @@ -37,6 +37,7 @@ var lodash = require('./lib_managed/lodash'), helpers = require('./lib/helpers'), + uuid = require('uuid'), object = typeof exports !== 'undefined' ? exports : this; // For eventual node.js environment support @@ -48,7 +49,9 @@ object.InQueueManager = function(TrackerConstructor, version, mutSnowplowState, asyncQueue, functionName) { - var trackerDictionary = {}, + // Page view ID should be shared between all tracker instances + var pageViewId = uuid.v4(), + trackerDictionary = {}, usedCookieNames = {}; /** @@ -115,7 +118,7 @@ } else { usedCookieNames[argmap.cookieName] = true; } - trackerDictionary[namespace] = new TrackerConstructor(functionName, namespace, version, mutSnowplowState, argmap); + trackerDictionary[namespace] = new TrackerConstructor(functionName, namespace, version, pageViewId, mutSnowplowState, argmap); trackerDictionary[namespace].setCollectorUrl(endpoint); } diff --git a/src/js/tracker.js b/src/js/tracker.js index 9e46f3000..b463d214f 100644 --- a/src/js/tracker.js +++ b/src/js/tracker.js @@ -56,6 +56,8 @@ * @param version The current version of the JavaScript Tracker * + * @param pageViewId ID for the current page view, to be attached to all events in the web_page context + * * @param mutSnowplowState An object containing hasLoaded, registeredOnLoadHandlers, and expireDateTime * Passed in by reference in case they are altered by snowplow.js * @@ -80,7 +82,7 @@ * 17. crossDomainLinker, false * 18. maxPostBytes, 40000 */ - object.Tracker = function Tracker(functionName, namespace, version, mutSnowplowState, argmap) { + object.Tracker = function Tracker(functionName, namespace, version, pageViewId, mutSnowplowState, argmap) { /************************************************************ * Private members @@ -245,6 +247,10 @@ // Context to be added to every event commonContexts = []; + if (autoContexts.webPage) { + commonContexts.push(getWebPageContext()); + } + if (autoContexts.gaCookies) { commonContexts.push(getGaCookiesContext()); } @@ -698,6 +704,20 @@ return combinedContexts; } + /** + * Put together a web page context with a unique UUID for the page view + * + * @return object web_page context + */ + function getWebPageContext() { + return { + schema: 'iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0', + data: { + id: pageViewId + } + }; + } + /** * Creates a context from the window.performance.timing object * diff --git a/tests/nonfunctional/in_queue.js b/tests/nonfunctional/in_queue.js index bd8bae81a..f3f3beae7 100644 --- a/tests/nonfunctional/in_queue.js +++ b/tests/nonfunctional/in_queue.js @@ -41,7 +41,7 @@ define([ var output = 0, writeCookies; - function mockTrackerConstructor (functionName, namespace, version, mutSnowplowState, argmap) { + function mockTrackerConstructor (functionName, namespace, version, sessionId, mutSnowplowState, argmap) { var configCollectorUrl, configWriteCookies = argmap.hasOwnProperty('writeCookies') ? argmap.writeCookies : true, attribute = 10; From 0cae8ce9759bfb0f7a753e9b236020f821749c8e Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Tue, 7 Jul 2015 17:48:04 +0100 Subject: [PATCH 06/13] Bumped payload_data schema to 1-0-3 (closes #385) --- src/js/out_queue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/out_queue.js b/src/js/out_queue.js index e76ff2012..2b47e7575 100644 --- a/src/js/out_queue.js +++ b/src/js/out_queue.js @@ -314,7 +314,7 @@ */ function encloseInPayloadDataEnvelope(events) { return json2.stringify({ - schema: 'iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-2', + schema: 'iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-3', data: events }); } From 3bf24f220ade31f0aa9337d407a678bb527ad4d1 Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Fri, 26 Jun 2015 16:40:01 +0100 Subject: [PATCH 07/13] Generated a unique session ID for each new session (closes #347) --- src/js/tracker.js | 88 +++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 33 deletions(-) diff --git a/src/js/tracker.js b/src/js/tracker.js index b463d214f..a8eff6380 100644 --- a/src/js/tracker.js +++ b/src/js/tracker.js @@ -46,6 +46,7 @@ forms = require('./forms'), requestQueue = require('./out_queue'), coreConstructor = require('snowplow-tracker-core'), + uuid = require('uuid'), object = typeof exports !== 'undefined' ? exports : this; // For eventual node.js environment support @@ -215,6 +216,9 @@ // Domain unique user ID domainUserId, + // ID for the current session + memorizedSessionId, + // Business-defined unique user ID businessUserId, @@ -518,8 +522,13 @@ * Sets the Visitor ID cookie: either the first time loadDomainUserIdCookie is called * or when there is a new visit or a new page view */ - function setDomainUserIdCookie(_domainUserId, createTs, visitCount, nowTs, lastVisitTs) { - cookie.cookie(getSnowplowCookieName('id'), _domainUserId + '.' + createTs + '.' + visitCount + '.' + nowTs + '.' + lastVisitTs, configVisitorCookieTimeout, configCookiePath, configCookieDomain); + function setDomainUserIdCookie(_domainUserId, createTs, visitCount, nowTs, lastVisitTs, sessionId) { + cookie.cookie( + getSnowplowCookieName('id'), + _domainUserId + '.' + createTs + '.' + visitCount + '.' + nowTs + '.' + lastVisitTs + '.' + sessionId, + configVisitorCookieTimeout, + configCookiePath, + configCookieDomain); } /** @@ -535,39 +544,40 @@ } /* - * Generate a new domainUserId and write it to a cookie + * Load the domain user ID and the session ID + * Set the cookies (if cookies are enabled) */ - function generateNewDomainUserId() { - domainUserId = createNewDomainUserId(); - if (configUseCookies && configWriteCookies) { - var nowTs = Math.round(new Date().getTime() / 1000); - setDomainUserIdCookie(domainUserId, nowTs, 0, nowTs, nowTs); - } - } + function initializeIdsAndCookies() { + var sesCookieSet = configUseCookies && !!getSnowplowCookieValue('ses'); + var idCookieComponents = loadDomainUserIdCookie(); - /* - * Try to load the domainUserId from the cookie - * If this fails, generate a new one - * If there is no session cookie, set one and increment the visit count - */ - function initializeDomainUserId() { - var idCookieValue; - if (configUseCookies) { - idCookieValue = getSnowplowCookieValue('id'); - } - if (idCookieValue) { - domainUserId = idCookieValue.split('.')[0]; + if (idCookieComponents[1]) { + domainUserId = idCookieComponents[1]; } else { - generateNewDomainUserId(); + domainUserId = createNewDomainUserId(); + idCookieComponents[1] = domainUserId; } - if (configUseCookies && configWriteCookies) { - if (!getSnowplowCookieValue('ses')) { - var idCookie = loadDomainUserIdCookie(); - idCookie[3] ++; - idCookie.shift(); - setDomainUserIdCookie.apply(null, idCookie); - } + + memorizedSessionId = idCookieComponents[6]; + + if (!sesCookieSet) { + + // Increment the session ID + idCookieComponents[3] ++; + + // Create a new sessionId + memorizedSessionId = uuid.v4(); + idCookieComponents[6] = memorizedSessionId; + // Set lastVisitTs to currentVisitTs + idCookieComponents[5] = idCookieComponents[4]; + } + + if (configWriteCookies) { setSessionCookie(); + // Update currentVisitTs + idCookieComponents[4] = Math.round(new Date().getTime() / 1000); + idCookieComponents.shift(); + setDomainUserIdCookie.apply(null, idCookieComponents); } } @@ -604,6 +614,11 @@ '' ]; } + + if (!tmpContainer[6]) { + tmpContainer[6] = uuid.v4(); + } + return tmpContainer; } @@ -618,11 +633,13 @@ sesname = getSnowplowCookieName('ses'), ses = getSnowplowCookieValue('ses'), // aka cookie.cookie(sesname) id = loadDomainUserIdCookie(), + cookiesDisabled = id[0], _domainUserId = id[1], // We could use the global (domainUserId) but this is better etiquette createTs = id[2], visitCount = id[3], currentVisitTs = id[4], - lastVisitTs = id[5]; + lastVisitTs = id[5], + sessionIdFromCookie = id[6]; if (configDoNotTrack && configUseCookies && configWriteCookies) { cookie.cookie(idname, '', -1, configCookiePath, configCookieDomain); @@ -630,6 +647,10 @@ return; } + if (cookiesDisabled === '0') { + memorizedSessionId = sessionIdFromCookie; + } + // New session? if (!ses && configUseCookies) { // New session (aka new visit) @@ -642,6 +663,7 @@ sb.add('vp', detectors.detectViewport()); sb.add('ds', detectors.detectDocumentSize()); sb.add('vid', visitCount); + sb.add('sid', memorizedSessionId); sb.add('duid', _domainUserId); // Set to our local variable sb.add('fp', userFingerprint); sb.add('uid', businessUserId); @@ -655,7 +677,7 @@ // Update cookies if (configUseCookies && configWriteCookies) { - setDomainUserIdCookie(_domainUserId, createTs, visitCount, nowTs, lastVisitTs); + setDomainUserIdCookie(_domainUserId, createTs, visitCount, nowTs, lastVisitTs, memorizedSessionId); setSessionCookie(); } } @@ -989,7 +1011,7 @@ */ updateDomainHash(); - initializeDomainUserId(); + initializeIdsAndCookies(); if (argmap.crossDomainLinker) { decorateLinks(argmap.crossDomainLinker); From 03d61eb10afe1a0fe869bb2d71188581c25e3d74 Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Tue, 30 Jun 2015 16:35:39 +0100 Subject: [PATCH 08/13] Configured session cookie timeout in argmap (closes #383) --- src/js/tracker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/tracker.js b/src/js/tracker.js index a8eff6380..7cb687c86 100644 --- a/src/js/tracker.js +++ b/src/js/tracker.js @@ -82,6 +82,7 @@ * 16. bufferSize, 1 * 17. crossDomainLinker, false * 18. maxPostBytes, 40000 + * 19. sessionCookieTimeout, 1800 */ object.Tracker = function Tracker(functionName, namespace, version, pageViewId, mutSnowplowState, argmap) { @@ -166,7 +167,7 @@ configVisitorCookieTimeout = 63072000, // 2 years // Life of the session cookie (in seconds) - configSessionCookieTimeout = 1800, // 30 minutes + configSessionCookieTimeout = argmap.hasOwnProperty('sessionCookieTimeout') ? argmap.sessionCookieTimeout : 1800, // 30 minutes // Default hash seed for MurmurHash3 in detectors.detectSignature configUserFingerprintHashSeed = argmap.hasOwnProperty('userFingerprintSeed') ? argmap.userFingerprintSeed : 123412414, From 965f3a035f77013790c5ad703886157b6e65fdda Mon Sep 17 00:00:00 2001 From: Fred Blundun Date: Fri, 3 Jul 2015 15:33:27 +0100 Subject: [PATCH 09/13] Updated examples to use version 2.5.0 --- examples/ads/async.html | 6 +++--- examples/web/async-large.html | 5 +++-- examples/web/async-medium.html | 3 ++- examples/web/async-small.html | 3 ++- examples/web/sync.html | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/ads/async.html b/examples/ads/async.html index 26c6cebf0..5c7f5364b 100644 --- a/examples/ads/async.html +++ b/examples/ads/async.html @@ -38,7 +38,7 @@

Asynchronous ad tracking examples for snowplow.js

;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","adTracker")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","adTracker")); window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', { 'encodeBase64': false @@ -110,7 +110,7 @@

Asynchronous ad tracking examples for snowplow.js

;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","adTracker")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","adTracker")); window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', { 'encodeBase64': false @@ -141,7 +141,7 @@

Asynchronous ad tracking examples for snowplow.js

;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","adTracker")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","adTracker")); window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', { 'encodeBase64': false diff --git a/examples/web/async-large.html b/examples/web/async-large.html index 9f423225b..26da51301 100644 --- a/examples/web/async-large.html +++ b/examples/web/async-large.html @@ -23,7 +23,7 @@ ;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","snowplow_1")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","snowplow_1")); window.snowplow_1('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker encodeBase64: false, // Default is true @@ -31,6 +31,7 @@ platform: 'mob', crossDomainLinker: function (link) {return link.id === 'legal'}, // Add duid and timestamp to the link with id "legal" contexts: { + webPage: true, performanceTiming: true } }); @@ -82,7 +83,7 @@ ;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","snowplow_2")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","snowplow_2")); window.snowplow_2('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker encodeBase64: false, // Default is true diff --git a/examples/web/async-medium.html b/examples/web/async-medium.html index cb6cb747b..d6368d6d9 100644 --- a/examples/web/async-medium.html +++ b/examples/web/async-medium.html @@ -24,7 +24,7 @@ ;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","new_name_here")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","new_name_here")); window.new_name_here('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { encodeBase64: false, @@ -32,6 +32,7 @@ platform: 'mob', cookieName: '_cf_3489563', // Cookie names should be unique to prevent mix-ups contexts: { + webPage: true, performanceTiming: true } }); diff --git a/examples/web/async-small.html b/examples/web/async-small.html index d89882d52..fb148c8db 100644 --- a/examples/web/async-small.html +++ b/examples/web/async-small.html @@ -23,13 +23,14 @@ ;(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","//d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js","snowplow")); + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js","snowplow")); window.snowplow('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker encodeBase64: false, // Default is true appId: 'CFe23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account platform: 'mob', contexts: { + webPage: true, gaCookies: true, performanceTiming: true } diff --git a/examples/web/sync.html b/examples/web/sync.html index 9d8bf402c..2364d55a8 100644 --- a/examples/web/sync.html +++ b/examples/web/sync.html @@ -19,7 +19,7 @@