Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan-rudder authored Mar 19, 2020
1 parent f74ec1a commit c185a92
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ The non-minified version of the code is shown below:

**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>
```

## Step 2: Identify your users using the `identify()` method:
The `identify()` method allows you to link users and their actions to a specific userid.

Expand Down Expand Up @@ -90,17 +95,14 @@ rudderanalytics.track(
currency: 'USD' ,
user_actual_id: 12345
},
{
anonymousId: "00000000000000000000000000"
},
() => {console.log("in track call");}
);
```
In the above example, the method tracks the event ‘test track event GA3’, information such as the revenue, currency, anonymousId.

You can use this method to track various other success metrics for your website, such as user signups, item purchases, article bookmarks, and much more.

**NOTE**: To override contextual information, for ex: anonymizing IP and other contextual fields, the following template can be used. Similarly for overriding the auto generated anonymousId with provided id.
**NOTE**: To override contextual information, for ex: anonymising IP and other contextual fields, the following template can be used. Similarly one can override the auto generated anonymousId with provided id. For this:

```
rudderanalytics.track(
Expand All @@ -124,6 +126,31 @@ And we’re done! You’ve successfully installed `rudder-analytics.js` tracking

For a detailed technical documentation and troubleshooting guide on the RudderStack’s JavaScript SDK, click [here](https://docs.rudderlabs.com/sdk-integration-guide/getting-started-with-javascript-sdk).

## Step 4: Check Ready State
There are cases when one may want to tap into the features provide by end destination SDKs to enhance tracking and other functionality. Rudder SDK exposes a `ready` api with a `callback` parameter that fires when the SDK is done initialising itself and other third-party native-sdk destinations.

Ex:
```
rudderanalytics.ready(
() => {console.log("we are all set!!!");}
);
```

# Autotrack
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 click [here](https://docs.rudderstack.com/sdk-integration-guide/getting-started-with-javascript-sdk/rudderstack-autotrack-feature).

To enable autotracking, make the load call as:
```
rudderanalytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI", {useAutoTracking: true});
```

# Self-hosted Config Plane
Since Rudder SDK depends on the config plane for fetching configs like `native-sdk enabled destinations etc`, if you are self-hosting the config plane, make the load call as:
```
rudderanalytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI", {configUrl: "CONFIG_PLANE_URI"});
```

# Contribute
You can start adding integrations of your choice for sending data through their JavaScript SDKs.

Expand Down

0 comments on commit c185a92

Please sign in to comment.