Skip to content

Commit

Permalink
Merge branch 'feature/0.14.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderdean committed Feb 12, 2014
2 parents 6923936 + 7e7f0a3 commit 65b15a1
Show file tree
Hide file tree
Showing 17 changed files with 662 additions and 515 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ results

npm-debug.log
node_modules

# creds for Grunt
aws*.json
17 changes: 17 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
Version 0.14.0 (2014-02-12)
---------------------------
Bumped version to 0.14.0
Removed all DEBUG blocks from codebase (#65)
Renamed requestStringBuilder to payloadBuilder and moved it into its own file, payload.js (#55)
Introduced gzipped sp.js library (#48)
Updated grunt and intern dependencies (#54)
Replaced snowpak.sh with Grunt and grunt-yui-compressor (#53)
Added setUserIdFromReferrer and setUserIdFromLocation (#57)
Added ability to pass a referrer to Snowplow from an IFRAME (#1)
Tested setDoNotTrack and renamed it to respectDoNotTrack (#28)
Moved detect...() functions into new file context.js (#37)
Moved cookie-related functionality into new file cookie.js (#77)
Removed getLegacyCookieName as no longer needed for migrating cookie IDs (#50)
Switched deployment to use Grunt (#58)
Added setUserIdFromCookie (#78)

Version 0.13.1 (2014-01-28)
---------------------------
Fixed bug where non-String values are not being added to our payload (#71)
Expand Down
149 changes: 149 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* JavaScript tracker for Snowplow: Gruntfile.js
*
* Significant portions copyright 2010 Anthon Pang. Remainder copyright
* 2012-2014 Snowplow Analytics Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Anthon Pang nor Snowplow Analytics Ltd nor the
* names of their contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

var semver = require('semver');

/*global module:false*/
module.exports = function(grunt) {

var pkg = grunt.file.readJSON('package.json');
var semVer = semver.parse(pkg.version);
pkg.pinnedVersion = semVer.major;

grunt.initConfig({

pkg: pkg,

aws: grunt.file.readJSON('aws.json'),

concat: {
dist: {
options: {
'report': 'gzip'
},
src: ['src/js/banner.js',
'src/js/lib/json.js',
'src/js/lib/jstz.js',
'src/js/init.js',
'src/js/helpers.js',
'src/js/cookie.js',
'src/js/context.js',
'src/js/lib/sha1.js',
'src/js/lib/murmur.js',
'src/js/lib/base64.js',
'src/js/payload.js',
'src/js/tracker.js',
'src/js/snowplow.js',
'src/js/constructor.js'],

dest: 'dist/snowplow.js'
}
},

min: {
dist: {
options: {
linebreak: 1000,
report: 'gzip'
},
files: [
{
src: 'dist/snowplow.js',
dest: 'dist/sp.js'
}
]
}
},

s3: {
options: {
key: '<%= aws.key %>',
secret: '<%= aws.secret %>',
bucket: '<%= aws.bucket %>',
access: 'public-read',
gzip: true
},
not_pinned: {
upload: [
{
src: 'dist/sp.js',
dest: '<%= pkg.version %>/sp.js'
}
]
},
pinned: {
upload: [
{
src: 'dist/sp.js',
dest: '<%= pkg.pinnedVersion %>/sp.js'
}
]
},
},

invalidate_cloudfront: {
options: {
key: '<%= aws.key %>',
secret: '<%= aws.secret %>',
distribution: '<%= aws.distribution %>'
},
not_pinned: {
files: [
{
src: ['<%= pkg.version %>/sp.js'],
dest: ''
}
]
},
pinned: {
files: [
{
src: ['<%= pkg.pinnedVersion %>/sp.js'],
dest: ''
}
]
}
}
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-yui-compressor');
grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-invalidate-cloudfront');

grunt.registerTask('default', ['concat', 'min']);
grunt.registerTask('publish', ['concat', 'min', 's3:not_pinned', 'invalidate_cloudfront:not_pinned']);
grunt.registerTask('publish-pinned', ['concat', 'min', 's3', 'invalidate_cloudfront']);

}
6 changes: 6 additions & 0 deletions aws.sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"key": "ADD HERE",
"secret": "ADD HERE",
"bucket": "ADD HERE",
"distribution": "ADD HERE"
}
14 changes: 9 additions & 5 deletions examples/web/async.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<!-- Snowplow starts plowing -->
<script type="text/javascript">
<script type="text/javascript">
var _snaq = _snaq || [];

_snaq.push(['setCollectorCf', 'd3rkrsqld9gmqf']); // Update to your CloudFront distribution subdomain
_snaq.push(['setAppId', 'CFe23a']); // Site ID can be anything you want. Set it if you're tracking more than one site in this account
_snaq.push(['setUserId', 'alex 123']); // Business-defined user ID
// Deprecated _snaq.push(['attachUserId', false]); // Don't attach &uid=xxx to the querystring
//_snaq.push(['setUserIdFromLocation', 'id']); // To test this, reload the page with ?id=xxx
//_snaq.push(['setUserIdFromCookie', '_sp_id.4209']) // Test this using Firefox because Chrome doesn't allow local cookies.
_snaq.push(['setCustomUrl', '/overridden-url/']); // Override the page URL
_snaq.push(['enableActivityTracking', 10, 10]); // Ping every 10 seconds after 10 seconds
_snaq.push(['enableLinkTracking']);
_snaq.push(['setPlatform', 'mob']);
_snaq.push(['setPlatform', 'mob']);
_snaq.push(['encodeBase64', false]); // Default is true
_snaq.push(['respectDoNotTrack', true]); // Prevent all tracking if browser's Do Not Track feature is enabled
// _snaq.push(['trackPageView', 'Async Test']); // Track the page view with custom title
_snaq.push(['trackPageView', , { // Auto-set page title; add page context
page: {
Expand All @@ -44,15 +46,16 @@

(function() {
var sp = document.createElement('script'); sp.type = 'text/javascript'; sp.async = true; sp.defer = true;
sp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.13.1/sp.js';
// sp.src = '../../dist/snowplow.js'; // For testing
//sp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.13.0/sp.js';
sp.src = '../../dist/snowplow.js'; // For testing
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sp, s);
})();
</script>
<!-- Snowplow stops plowing -->

<!-- Example events -->
<script type="text/javascript">

function playMix() {
alert("Playing a DJ mix");
_snaq.push(['trackStructEvent', 'Mixes', 'Play', 'MRC/fabric-0503-mix', '', '0.0']);
Expand Down Expand Up @@ -133,6 +136,7 @@ <h1>Asynchronous_examples_for_snowplow.js</h1>
<button type="button" onclick="viewProduct()">View a product</button><br>
<button type="button" onclick="addEcommerceTransaction()">Add an ecommerce transaction</button>
</p>
<p>Warning: if your browser's Do Not Track feature is enabled and respectDoNotTrack is not commented out, all tracking will be prevented.</p>
</body>

</html>
4 changes: 2 additions & 2 deletions examples/web/sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

<!-- Snowplow starts plowing -->
<script type="text/javascript">
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.13.1/sp.js';
// var spSrc = '../../dist/snowplow.js'; // For testing
//var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.13.0/sp.js';
var spSrc = '../../dist/snowplow.js'; // For testing
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"name": "snowplow-tracker",
"version": "0.13.1",
"version": "0.14.0",
"devDependencies": {
"grunt": "~0.4.1",
"intern": "~1.2.1"
"grunt": "~0.4.2",
"intern": "~1.3.1",
"semver": "~2.2.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-yui-compressor": "git://github.com/fblundun/grunt-yui-compressor.git#feature/issue-8",
"grunt-invalidate-cloudfront": "~0.1.4",
"grunt-s3": "~0.2.0-alpha.3"
},
"repository": {
"type": "git",
Expand Down
97 changes: 0 additions & 97 deletions scripts/snowpak.sh

This file was deleted.

11 changes: 0 additions & 11 deletions src/dependencies.txt

This file was deleted.

4 changes: 2 additions & 2 deletions src/js/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Snowplow - The world's most powerful web analytics platform
*
* @description JavaScript tracker for Snowplow
* @version 0.13.1
* @author Alex Dean, Simon Andersson, Anthon Pang
* @version 0.14.0
* @author Alex Dean, Simon Andersson, Anthon Pang, Fred Blundun
* @copyright Anthon Pang, Snowplow Analytics Ltd
* @license Simplified BSD
*/
Expand Down
Loading

0 comments on commit 65b15a1

Please sign in to comment.