Skip to content

Commit

Permalink
Merge branch 'feature/2.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fblundun committed Jul 22, 2015
2 parents d881df9 + 592b51f commit b46adf7
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 99 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Version 2.5.0 (2015-07-22)
--------------------------
Generated a unique session ID for each new session (#347)
Added a page view UUID (#369)
Maintained visit count when cookies are disabled (#388)
Bumped payload_data schema to 1-0-3 (#385)
Added Grunt task to build the tracker skipping the lodash and minification tasks (#382)
Added ability to configure the session cookie timeout in the argmap (#383)
Removed deprecated performanceTiming argument to trackPageView (#375)
Added ability to pass a context-generating function to trackPageView (#372)
Removed configWriteCookies setting (#390)
Updated browser feature detection tests (#378)

Version 2.4.3 (2015-04-15)
--------------------------
Added License button to README (#357)
Expand Down
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
6 changes: 3 additions & 3 deletions examples/ads/async.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
;(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
Expand Down Expand Up @@ -110,7 +110,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
;(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
Expand Down Expand Up @@ -141,7 +141,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
;(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
Expand Down
5 changes: 3 additions & 2 deletions examples/web/async-large.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
;(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
appId: 'CFe23a', // Site ID can be anything you want. Set it if you're tracking more than one site in this account
platform: 'mob',
crossDomainLinker: function (link) {return link.id === 'legal'}, // Add duid and timestamp to the link with id "legal"
contexts: {
webPage: true,
performanceTiming: true
}
});
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion examples/web/async-medium.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
;(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,
appId: 'CFe23a',
platform: 'mob',
cookieName: '_cf_3489563', // Cookie names should be unique to prevent mix-ups
contexts: {
webPage: true,
performanceTiming: true
}
});
Expand Down
3 changes: 2 additions & 1 deletion examples/web/async-small.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion examples/web/sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<!-- Snowplow starts plowing -->
<script type="text/javascript">
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.4.3/sp.js';
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.5.0/sp.js';
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
13 changes: 5 additions & 8 deletions src/js/in_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -48,8 +49,9 @@

object.InQueueManager = function(TrackerConstructor, version, mutSnowplowState, asyncQueue, functionName) {

var trackerDictionary = {},
usedCookieNames = {};
// Page view ID should be shared between all tracker instances
var pageViewId = uuid.v4(),
trackerDictionary = {}

/**
* Get an array of trackers to which a function should be applied.
Expand Down Expand Up @@ -110,12 +112,7 @@
*/
function createNewNamespace(namespace, endpoint, argmap) {
argmap = argmap || {};
if ((!argmap.writeCookies) && (argmap.cookieName in usedCookieNames)) {
argmap.writeCookies = false;
} 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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/out_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down
Loading

0 comments on commit b46adf7

Please sign in to comment.