rudder-sdk-js
Advanced tools
Comparing version 1.0.14 to 1.0.15
{ | ||
"name": "rudder-sdk-js", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "Rudder Javascript SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,64 +15,5 @@ # What is RudderStack? | ||
To integrate the SDK, place the following code snippet in the `<head>` section of your website. | ||
To integrate the SDK: | ||
You can use either the minified or non-minified version of the code: | ||
The minified version is as follows: | ||
``` | ||
<script> | ||
rudderanalytics=window.rudderanalytics=[];for(var methods=["load","page","track","alias","group","identify","ready","reset"],i=0;i<methods.length;i++){var method=methods[i];rudderanalytics[method]=function(d){return function(){rudderanalytics.push([d,...arguments])}}(method)}rudderanalytics.load("YOUR_WRITE_KEY","DATA_PLANE_URI"),rudderanalytics.page(); | ||
</script> | ||
<script src="https://cdn.rudderlabs.com/v1/rudder-analytics.min.js"></script> | ||
``` | ||
The non-minified version of the code is shown below: | ||
``` | ||
<script> | ||
rudderanalytics = window.rudderanalytics = []; | ||
var methods = [ | ||
"load", | ||
"page", | ||
"track", | ||
"identify", | ||
"alias", | ||
"group", | ||
"ready", | ||
"reset" | ||
]; | ||
for (var i = 0; i < methods.length; i++) { | ||
var method = methods[i]; | ||
rudderanalytics[method] = function (methodName) { | ||
return function () { | ||
rudderanalytics.push([methodName].concat(Array.prototype.slice.call(arguments))); | ||
}; | ||
}(method); | ||
} | ||
rudderanalytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI"); | ||
//For example, | ||
//rudderanalytics.load("1Qb1F3jSWv0eKFBPZcrM7ypgjVo", "http://localhost:8080"); | ||
rudderanalytics.page(); | ||
</script> | ||
<script src="https://cdn.rudderlabs.com/v1/rudder-analytics.min.js"></script> | ||
``` | ||
**NOTE**: Whichever version of the code you use, you need to replace `YOUR_WRITE_KEY` with the write key in the RudderStack Control Plane and `DATA_PLANE_URI` with the URI of the RudderStack Server/ Data Plane. | ||
You can also execute the min file in async/defer way, like: | ||
``` | ||
<script async src="https://cdn.rudderlabs.com/rudder-analytics.min.js"></script> | ||
``` | ||
**NOTE**: We are moving our sdk to a diiferent path from the earlier [https://cdn.rudderlabs.com/rudder-analytics.min.js](https://cdn.rudderlabs.com/rudder-analytics.min.js) to [https://cdn.rudderlabs.com/v1/rudder-analytics.min.js](https://cdn.rudderlabs.com/v1/rudder-analytics.min.js). The earlier path may not be maintained in coming releases. | ||
**Alternative installation using NPM** | ||
**Installation using NPM** | ||
It is recommended to use the snippet above to use Rudder SDK in your websites, but one can use this [NPM module](https://www.npmjs.com/package/rudder-js) to package Rudder directly into your project. | ||
@@ -95,2 +36,13 @@ | ||
``` | ||
For destinations where you don't want the SDK to load the third-party scripts separately, modify the load call: | ||
``` | ||
rudderanalytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI", {loadIntegration: false}) | ||
// the SDK expects that the destination global queue or function for pushing events is | ||
// already present for the destinations. | ||
// Currently, the loadIntegration flag is supported for Amplitude and | ||
// Google Analytics destinations. The SDK expects window.amplitude and window.ga to be already | ||
// defined by the user separately for sending events to these destinations. | ||
``` | ||
You can also refer to the sample projects for a walkthrough of the above: [sample angular project](https://github.com/rudderlabs/rudder-analytics-angular) and [sample react project](https://github.com/rudderlabs/rudder-analytics-react) | ||
@@ -235,6 +187,2 @@ | ||
| **IMPORTANT**: We have deprecated the Autotrack feature for the RudderStack JavaScript SDK. If you still wish to use it for your project, refer to [this security checkpoints](https://github.com/rudderlabs/rudder-sdk-js-autotrack#security). | | ||
|:------| | ||
It may happen that the need arises to track most of user interactions with a web-app. It becomes hard for a developer to capture these DOM interactions and make track calls for all. The autotrack feature of Rudder SDK helps in tracking all user interactions like `click | change | submit` automatically. The data generated will be verbose and to make sense of the data, one can use `user transformations` from the config-plane to build use-cases like monitoring user journeys etc. For more information and payload structure, click [here](https://docs.rudderstack.com/sdk-integration-guide/getting-started-with-javascript-sdk/rudderstack-autotrack-feature). | ||
@@ -241,0 +189,0 @@ |
Sorry, the diff of this file is too big to display
643824
5
17320
224