-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Just had a question about trying to load snowplow through Bower, in which case the sp.js file would be bundled with the application as an installed dependency.
To implement this, I did the following
- Removed
.gitignorefrom the dist folder in my fork of snowplow-tracker-javascript - Ran
grunt - Committed the generated files
- Added this fork as a dependency in bower.json of my application
Essentially, in this case, the build would handle injecting sp.js into a script tag (before any application scripts) in index.html.
This would mean not having to include that part of the setup snippet that creates the script tag and sets the src, essentially now I would only need / want
(function (p, l, o, w, i) {
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 || [];
}
}(window, document, null, null, 'snowplow'));
When trying this, I no longer see snowplow analytic traffic in Chrome network tab.
Is this possible? Eventually, I would like my build to handle uploading files to S3 / Cloudfront, either as individual files or conact / min file, and this would reduce the coupling between this init script (since it requires specifying a path), and how snowplow gets loaded into my application. We also want to be able to version our fork as we will be modifying it as need to support additional tracking metrics over time, which again help with not having to specify a path in the setup snippet.
Any thoughts / feedback appreciated.