Skip to content

Commit

Permalink
Merge branch 'release/2.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
chuwy committed Mar 7, 2017
2 parents e2ab225 + 2f66d49 commit 0ba1bad
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 2.7.2 (2017-03-07)
--------------------------
Add defensive check for window.optimizely.data in getOptimizelyStateContexts (#555)

Version 2.7.1 (2017-03-06)
--------------------------
Add defensive check for window.optimizely.data (#553)
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.7.1/sp.js","adTracker"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/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.7.1/sp.js","adTracker"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/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.7.1/sp.js","adTracker"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/sp.js","adTracker"));

window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
'encodeBase64': false
Expand Down
4 changes: 2 additions & 2 deletions examples/web/async-large.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.1/sp.js","snowplow_1"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/sp.js","snowplow_1"));

window.snowplow_1('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
encodeBase64: false, // Default is true
Expand Down Expand Up @@ -83,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.7.1/sp.js","snowplow_2"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/sp.js","snowplow_2"));

window.snowplow_2('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
encodeBase64: false, // Default is true
Expand Down
2 changes: 1 addition & 1 deletion examples/web/async-medium.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.1/sp.js","new_name_here"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/sp.js","new_name_here"));

window.new_name_here('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', {
encodeBase64: false,
Expand Down
2 changes: 1 addition & 1 deletion examples/web/async-small.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.1/sp.js","snowplow"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.7.2/sp.js","snowplow"));

window.snowplow('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
encodeBase64: false, // Default is true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snowplow-tracker",
"version": "2.7.1",
"version": "2.7.2",
"dependencies": {
"browser-cookie-lite": "0.3.1",
"jstimezonedetect": "1.0.5",
Expand Down
28 changes: 14 additions & 14 deletions src/js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,23 +897,23 @@
}
}

/**
/**
* Check that *both* optimizely and optimizely.data exist and return
* optimizely.data.property
*
* @param property optimizely data property
* @param snd optional nested property
*/
function getOptimizelyData(property, snd) {
var data;
if (windowAlias.optimizely && windowAlias.optimizely.data) {
data = windowAlias.optimizely.data[property];
if (typeof snd !== 'undefined' && data !== undefined) {
data = data[snd]
* @param property optimizely data property
* @param snd optional nested property
*/
function getOptimizelyData(property, snd) {
var data;
if (windowAlias.optimizely && windowAlias.optimizely.data) {
data = windowAlias.optimizely.data[property];
if (typeof snd !== 'undefined' && data !== undefined) {
data = data[snd]
}
}
return data
}
}
return data
}

/**
* Get data for Optimizely "lite" contexts - active experiments on current page
Expand Down Expand Up @@ -985,7 +985,7 @@
}
}

var state = windowAlias.optimizely.data.state;
var state = getOptimizelyData('state');
if (state) {
var contexts = [];
var activeExperiments = state.activeExperiments || [];
Expand Down

0 comments on commit 0ba1bad

Please sign in to comment.