Skip to content

Commit

Permalink
Merge pull request #736 from snowplow/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
colmsnowplow committed Sep 25, 2019
2 parents ed751aa + ead40bf commit 090d313
Show file tree
Hide file tree
Showing 18 changed files with 425 additions and 278 deletions.
20 changes: 15 additions & 5 deletions .travis.yml
Expand Up @@ -26,18 +26,28 @@ before_script:
script:
- cd core && grunt intern && cd ..
- grunt travis
before_deploy:
- grunt default
deploy:
- provider: script
skip_cleanup: true
script: ./.travis/deploy.py
on:
condition: '"$(.travis/is_core_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
condition: '"$(.travis/is_correct_core_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
tags: true
- provider: script
# - provider: script
# skip_cleanup: true
# script: ./.travis/deploy.py
# on:
# condition: '"$(.travis/is_tracker_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
# tags: true
- provider: releases
skip_cleanup: true
script: ./.travis/deploy.py
api_key:
secure: juUw//XdoRAb494NvxNTghZC7TBJLBx8WdAZsrSGp+6Sf7yPZ6skDt/+qU2VgrG/4RBWUwl3lnAWobiY6ZQQSD95lQDyVM9IdC9JHchhVav1nHBrcJWubEKN/R0Ri/3XjLFJ/LFlkdOteYYPVZR6MGehRR9Gsnazavk9+0x6c1A=
file: $TRAVIS_BUILD_DIR/dist/sp.js
on:
condition: '"$(.travis/is_tracker_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
condition: '"$(.travis/is_correct_tracker_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
tags: true
env:
global:
Expand All @@ -52,7 +62,7 @@ env:
# AWS_SECRET_KEY
- secure: C+PTon3PsELG2bFlAZ5qfinWVih8XxlZV45Gk2W5i2CK1AROJ60lnfhgYZM4YidIRcA/V/zbm8tDgZbA8i/MVKcO5f1qbD5Skyo2fEFRlXoSWhtwaScViihN338U/SsEviKThIGSSLgdfsQ0CW7TYxvetFSwXFyZPPrYrenF3dk=
# NPM_AUTH_TOKEN
- secure: Dtc3aFnUfquuC+E3ZOvs57SZy3Sp+3QdXQHR0xjekvpF4FgaKvDpISBfLTCs1ODuHZ+K1pPn9/i4yGNE7ei8z3VTbRY4nYPM5VG7jlqwP1iaFqRopnQmpV9c7yhMSHKhXrSWj/Gwo/9UHpia6muQUSK4hbPvhZMf0Rd3s06Z07M=
- secure: PwIU7BHXhpHUhFh/sxRO1o9awiTKJ5PNrSgeTytp2CcE22q0yx/q5cKJp/gPWiY0l0sKSrNjcV/s0hifg3d8q4YcTa3JEK6Ap71ehOsCIJQD897cgTMqgawkdspeyZL8OPPAs0hMwHFAASm7RDTe4zz1rYMFs2+DYLbIKu0Ki8I=
- AWS_S3_BUCKET=snowplow-static-js
- AWS_REGION=eu-west-1
- AWS_CF_DISTRIBUTION=E1RICD7QD0F2KE
19 changes: 19 additions & 0 deletions .travis/is_correct_core_release_tag.sh
@@ -0,0 +1,19 @@
#!/bin/bash

tag=$1
cicd=${tag:0:4}
release=${tag:5}
coreVersion=$(node -e 'const {version} = require("./core/package.json"); console.log(`${version}`);')

if [ "${cicd}" == "core" ]; then
if [ "${release}" == "" ]; then
echo "Warning! No release specified! Ignoring."
exit 2
elif [ "${release}" != "${coreVersion}" ]; then
echo "Tagged version ${release} does not equal core package version ${coreVersion}"
exit 1
fi
exit 0
else
exit 1
fi
17 changes: 17 additions & 0 deletions .travis/is_correct_tracker_release_tag.sh
@@ -0,0 +1,17 @@
#!/bin/bash

tag=$1
release=$tag
trackerVersion=$(node -e 'const {version} = require("./package.json"); console.log(`${version}`);')

if [ "${release}" == "" ]; then
echo "Warning! No release specified! Ignoring."
exit 2
else
if [ "${release:0:4}" == "core" ]; then
echo "Core relase, not tracker"
elif [ "${release}" != "${trackerVersion}" ]; then
echo "Tagged version ${release} does not equal tracker package version ${trackerVersion}"
fi
fi
exit 0
13 changes: 11 additions & 2 deletions CHANGELOG
@@ -1,3 +1,12 @@
Version 2.11.0 (2019-08-28)
---------------------------
Core: Send focus_form 'type' field as 'elementType' (#731)
Update Sauce Connect version (#735)
Add GDPR context (#645)
Rotate npm token (#737)
Deploy tracker asset directly to Github Tagged release rather than cloudfront (#741)
Ensure that the intended version is deployed (#739)

Version 2.10.2 (2019-02-07)
---------------------------
Update integration template to set eventMethod arg to get (#713)
Expand Down Expand Up @@ -358,7 +367,7 @@ Added examples of tracker namespacing (#159)
Split async.html into async-small.html, async-medium.html (#160)
Linked the Technical Docs and Setup Guide images to the appropriate pages (#164)
Made JS invocation tag part of the build process (#158)
Fixed warnings generated by the Closure Compiler, thanks @steve-gh! (#170)
Fixed warnings generated by the Closure Compiler, thanks @steve-gh! (#170)
Added untracked files which should be ignored to .gitignore (#173)
Removed ads/sync.html (#182)
Updated ads/async.html (#183)
Expand Down Expand Up @@ -412,7 +421,7 @@ Added getting started info for developers to README, thanks @pkallos! (#129)

Version 0.14.1 (2014-03-12)
---------------------------
Fixed bug where fromQuerystring was matching fragments instead of just the querystring (#116)
Fixed bug where fromQuerystring was matching fragments instead of just the querystring (#116)

Version 0.14.0 (2014-02-12)
---------------------------
Expand Down
12 changes: 4 additions & 8 deletions core/lib/core.ts
Expand Up @@ -845,21 +845,17 @@ export function trackerCore(base64: boolean, callback?: (PayloadData) => void) {
tstamp?: Timestamp): PayloadData {

let event_schema = '';
let event_data:any = {formId, elementId, nodeName, elementClasses, value};
if (schema === 'change_form'){
event_schema = 'iglu:com.snowplowanalytics.snowplow/change_form/jsonschema/1-0-0';
event_data.type = type
} else if (schema === 'focus_form') {
event_schema = 'iglu:com.snowplowanalytics.snowplow/focus_form/jsonschema/1-0-0';
event_data.elementType = type
}
return trackSelfDescribingEvent({
schema: event_schema,
data: removeEmptyProperties({
formId: formId,
elementId: elementId,
nodeName: nodeName,
type: type,
elementClasses: elementClasses,
value: value
}, {value: true})
data: removeEmptyProperties(event_data, {value: true})
}, context, tstamp);
},

Expand Down
2 changes: 1 addition & 1 deletion core/package.json
@@ -1,6 +1,6 @@
{
"name": "snowplow-tracker-core",
"version": "0.7.0",
"version": "0.7.1",
"devDependencies": {
"@types/es6-shim": "0.31.34",
"@types/node": "^9.6.7",
Expand Down
18 changes: 9 additions & 9 deletions core/tests/unit/core.js
@@ -1,6 +1,6 @@
/*
* JavaScript tracker core for Snowplow: tests/integration.js
*
*
* Copyright (c) 2014-2016 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
Expand Down Expand Up @@ -220,7 +220,7 @@ define([
schema: 'iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0',
data: {
impressionId: impressionId,
costModel: costModel,
costModel: costModel,
cost: cost,
targetUrl: targetUrl,
bannerId: bannerId,
Expand Down Expand Up @@ -291,14 +291,14 @@ define([
schema: 'iglu:com.snowplowanalytics.snowplow/ad_conversion/jsonschema/1-0-0',
data: {
conversionId: conversionId,
costModel: costModel,
costModel: costModel,
cost: cost,
category: category,
action: action,
property: property,
initialValue: initialValue,
advertiserId: advertiserId,
campaignId: campaignId
campaignId: campaignId
}
};
var expected = {
Expand Down Expand Up @@ -414,9 +414,9 @@ define([
formId: formId,
elementId: elementId,
nodeName: nodeName,
type: type,
elementClasses: elementClasses,
value: value
value: value,
elementType: type
}
};

Expand Down Expand Up @@ -445,9 +445,9 @@ define([
formId: formId,
elementId: elementId,
nodeName: nodeName,
type: type,
elementClasses: elementClasses,
value: value
value: value,
type: type
}
};

Expand Down Expand Up @@ -743,5 +743,5 @@ define([
assert(!('ttm' in result), 'ttm should absent');
}
});

});
22 changes: 11 additions & 11 deletions examples/ads/async.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
<!--
! Copyright (c) 2012 Snowplow Analytics Ltd. All rights reserved.
!
! This program is licensed to you under the Apache License Version 2.0,
Expand Down Expand Up @@ -38,16 +38,16 @@ <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.10.2/sp.js","adTracker"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","adTracker"));

window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
'encodeBase64': false
});

window.adTracker('trackAdImpression:' + rnd,
window.adTracker('trackAdImpression:' + rnd,

'67965967893', // impressionId
'cpa', // costModel - 'cpa', 'cpc', or 'cpm'
'cpa', // costModel - 'cpa', 'cpc', or 'cpm'
10, // cost - requires costModel
'http://www.example.com', // targetUrl
'23', // bannerId
Expand All @@ -57,11 +57,11 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
);

function clickHandler() {
window.adTracker('trackAdClick:' + rnd,
window.adTracker('trackAdClick:' + rnd,

'http://www.example.com', // targetUrl
'12243253', // clickId
'cpm', // costModel
'cpm', // costModel
0.5, // cost
'23', // bannerId
'7', // zoneId
Expand All @@ -75,7 +75,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
document.body.appendChild(button);
button.onclick = function() {

window.adTracker('trackAdConversion:' + rnd,
window.adTracker('trackAdConversion:' + rnd,

'743560297', // conversionId
'cpm', // costModel
Expand Down Expand Up @@ -110,14 +110,14 @@ <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.10.2/sp.js","adTracker"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","adTracker"));

window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
'encodeBase64': false
});

window.adTracker('trackAdImpression:' + rnd, '17320923496', 'cpm', 6.5, 'http://www.example.com', '127', '', '');

function clickHandler() {
window.adTracker('trackAdClick:' + rnd, 'http://www.example.com', '', 'cpm', 6.5, '127', '', '', '17320923496', '');
}
Expand All @@ -141,8 +141,8 @@ <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.10.2/sp.js","adTracker"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","adTracker"));

window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
'encodeBase64': false
});
Expand Down
6 changes: 3 additions & 3 deletions examples/web/async-large.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
<!--
! Copyright (c) 2012-2013 Snowplow Analytics Ltd. All rights reserved.
!
! This program is licensed to you under the Apache License Version 2.0,
Expand All @@ -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.10.2/sp.js","snowplow_1"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/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.10.2/sp.js","snowplow_2"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","snowplow_2"));

window.snowplow_2('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
encodeBase64: false, // Default is true
Expand Down
4 changes: 2 additions & 2 deletions examples/web/async-medium.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
<!--
! Copyright (c) 2012-2013 Snowplow Analytics Ltd. All rights reserved.
!
! This program is licensed to you under the Apache License Version 2.0,
Expand All @@ -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.10.2/sp.js","new_name_here"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","new_name_here"));

window.new_name_here('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', {
encodeBase64: false,
Expand Down
4 changes: 2 additions & 2 deletions examples/web/async-small.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
<!--
! Copyright (c) 2012-2013 Snowplow Analytics Ltd. All rights reserved.
!
! This program is licensed to you under the Apache License Version 2.0,
Expand All @@ -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.10.2/sp.js","snowplow"));
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js","snowplow"));

window.snowplow('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
encodeBase64: false, // Default is true
Expand Down
6 changes: 3 additions & 3 deletions examples/web/sync.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
<!--
! Copyright (c) 2012-2013 Snowplow Analytics Ltd. All rights reserved.
!
! This program is licensed to you under the Apache License Version 2.0,
Expand All @@ -19,7 +19,7 @@

<!-- Snowplow starts plowing -->
<script type="text/javascript">
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.10.2/sp.js';
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.11.0/sp.js';
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
Expand All @@ -41,7 +41,7 @@
}
function addProduct() {
alert("Adding a product to basket");
snowplowTracker.trackStructEvent('Checkout', 'Add', 'ASO01043', 'blue:xxl', '2.0');
snowplowTracker.trackStructEvent('Checkout', 'Add', 'ASO01043', 'blue:xxl', '2.0');
}
function viewProduct() {
alert("Viewing a product");
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "snowplow-tracker",
"version": "2.10.2",
"version": "2.11.0",
"dependencies": {
"snowplow-tracker-core": "0.7.0",
"snowplow-tracker-core": "0.7.1",
"browser-cookie-lite": "0.3.1",
"jstimezonedetect": "1.0.5",
"murmurhash": "0.0.2",
Expand Down

0 comments on commit 090d313

Please sign in to comment.