hockeystack-js
You should make your changes in the develop
branch. We don't actually use the master
branch here.
The main tracking script is in hockeystack.js
. This script can call other integration specific scripts within it.
CDN and Hosting
The script is generated through an NPM package and is hosted through the JSDelivr CDN like this: https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js
Deploying to CDN
When you've made a change and want to deploy it to the CDN, follow these steps:
git push
your changes todevelop
branchnpm version patch
to save your changes to the NPM package. This will output the new version of the script in your terminal (Make sure you have authenticated)npm publish
to publish them to NPMgit push
again because NPM creates one extra commit- Purge the script in CDN to get the latest version.
- Hard reload the jsdelivr link and make sure you see the new version.
NPM Authentication
We have an NPM account that you might need to publish the change. Ask Arda for the username and password.
Send requests
- First we try to send requests via Beacon (sendReqViaBeacon - hockeystack.js)
- If it fails, we are retrying via XHR (sendReqViaXHR - hockeystack.js)
- You can check sendActions function in the hockeystack.js file to have better understanding of the request flow
Testing new features
We have a file called hockeystack-staging.js, we use it to test new stuff in production. Use hsstaging=true in the URL to enable it
Debug mode
If you add hsdebug=true to the query parameters in the URL, you can enable Debug Mode. This basically logs a lot more things in the browser console to debug issues faster.