RudderStack is a customer data pipeline tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.
More information on RudderStack can be found here.
The resources in this repository allow you to render the rudder-analytics.js
snippet dynamically, as an alternative to the preferred and recommended method, i.e. the RudderStack JavaScript SDK quickstart guide.
Note that when using this in-browser, the global rudderanalytics
object will not be defined until the snippet is rendered and executed. This package is supported on IE8+, Chrome, Firefox, Safari 9, Microsoft Edge, Node.js 0.10+
For IE7 support, install a global JSON
polyfill on the page prior to loading this package.
// var snippet = require('@segment/snippet');
var contents = snippet.max({
writeKey: '1Yt0USbr7HhL1KWTpEq4Y73NCNz', // "YOUR_WRITE_KEY"
dataPlaneUri: 'https://hosted.rudderlabs.com', // "DATA_PLANE_URI"
});
Returns the maxified version of the rudder-analytics.js snippet given a set of options
:
host
: the domain name where the analytics.js script is hosted.writeKey
: thewriteKey
from RudderStack Control Plane.page
: the options to pass torudderanalytics.page
. ifpage
isfalse
, then thepage()
call will be omitted.load
: if set tofalse
theload()
call will be omitted. This is useful for if you want dynamically control the load process on the client-side for things like GDPR.
Returns the minified version of the snippet.
- Add simple example
- Update
test/render.test.js
- Update
test/snippet.test.js
- README add useAutoTrack & configUrl
- README update opts description
- CI Build for dist
- Proper package manager set up
If you come across any issues while configuring or using this repository, please feel free to start a conversation on our Slack channel. We will be happy to help you.