-
Notifications
You must be signed in to change notification settings - Fork 2
Modifying snowplow js
HOME > SNOWPLOW SETUP GUIDE > Step 2: setup a Tracker > JavaScript Tracker > Modifying Snowplow.js
It may be necessary for you to make changes to snowplow.js. If you do, then you will also need to minify your updated snowplow.js prior to deploying it. This guide covers how to do this.
To continue with this guide, you will need the following
- Access to a Unix-like command line
- Familiarity with and access to [Git] [git]
- Node.js version 10 or above installed
- npm version 1.4.0 or above installed
- Some level of technical ability ta2, where
ta1 < ta2 < ninja
See this page for guidance help installing node and npm.
Once you have those ready, please read on...
First please download the source code to your development machine:
$ cd ~/development
$ git clone git@github.com:snowplow/snowplow-javascript-tracker.git
$ cd snowplow-javascript-tracker
$ npm install
$ grunt
$ cd dist
$ ls
bundle.js snowplow.js sp.js
In the listing above, bundle.js is the [Browserified][browserify] JavaScript; snowplow.js is identical to bundle.js but has a banner comment at the top; and sp.js is the minified version.
Making changes to snowplow.js (and testing them) is out of scope of this document. A brief overview of the steps it involves:
- Make whatever changes you want to inside
snowplow-javascript-tracker/src/js - Run
$ gruntfrom thesnowplow-javascript-trackerdirectory to rebuild the files insnowplow-javascript-tracker/dist - Use the example page
snowplow-javascript-tracker/examples/web/async/async-small.htmlto test your changes locally. You will probably want to edit that file, replacing"//d1fc8wv8zag5ca.cloudfront.net/2.0.0/sp.js"with"../../dist/snowplow.js", so that it loads your modified copy ofsnowplow.js.
Use your standard asset pipelining strategy to upload the minified sp.js JavaScript to your servers. Note that to avoid "mixed content" warnings, Snowplow expects the sp.js JavaScript to be available both via HTTP and via HTTPS.
As a final step, you will want to just check that your customised sp.js JavaScript is working okay.
To do this, please follow the testing instructions at the end of the guide to [Integrating Snowplow tags directly onto your website] (Integrating Javascript tags onto your website#testing).
Finished setting up the [JavaScript Tracker] (javascript-tracker-setup)? Then you are ready to [setup EmrEtlRunner] (Setting-up-Snowplow#wiki-step3).
Return to the [setup guide] (Setting-up-Snowplow).
Home | About | Project | Setup Guide | Technical Docs | Copyright © 2012-2014 Snowplow Analytics Ltd
HOME > [TECHNICAL DOCUMENTATION](Snowplow technical documentation) > Trackers > Javascript tracker
1. Trackers
Overview
Javascript Tracker
- Overview
- General parameters (version 2)
- General parameters (version 1)
- Specific event tracking parameters (version 2)
- Specific event tracking parameters (version 1)
- The relationship between Snowplow.js and Piwik.js
- Modifying Snowplow.js
No-JS Tracker
Lua Tracker
Arduino Tracker
2. Collectors
Overview
Cloudfront Collector
Clojure Collector (Elastic Beanstalk)
Scala Stream Collector
3. ETL
Overview
EmrEtlRunner
Hive ETL
Hadoop ETL
C. Canonical Snowplow event model
4. Storage
[Overview](storage documentation)
S3 / Hive
Amazon Redshift
Infobright
D. Snowplow storage formats (to write)
5. Analytics
Analytics documentation
Common
Artifact repositories