Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #1

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 37 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
# Rudder JS-SDK
# What is Rudder?

**Short answer:**
Rudder is an open-source Segment alternative written in Go, built for the enterprise. .

**Long answer:**
Rudder is a platform for collecting, storing and routing customer event data to dozens of tools. Rudder is open-source, can run in your cloud environment (AWS, GCP, Azure or even your data-centre) and provides a powerful transformation framework to process your event data on the fly.


Released under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)


# Rudder JS-SDK

This repo contains **builds** and **source-code** to integrate with your web-app and node applications. Use this to send analytics data from your applications to ever evolving destinations such as (HubSpot, Google Analytics and many more...)



# How to get started



Under the **analytics** folder, navigate to **dist** where you can find the minified and unminified versions of the sdk. There are two builds for working with browser based applications and node applications, mainly **browser.js** and **node.js**. There is also a minified **browser.min.js** which is hosted.

Few sample usage of the sdk can be found under **tests** directory for vanilla html, Angular, and node integrations.

**Setup**
```
// Script load start for working in browser env

<script type="text/javascript">
analytics = window.analytics = [];
var methods = [
"load",
"page",
"track",
"identify",
"trackEvent",
"trackPage",
"identifyUser",
"reset"];

for(var i=0;i<methods.length;i++){
var method = methods[i];
analytics[method] = function(methodName){
return function(){
analytics.push([methodName, ...arguments]);
"load",
"page",
"track",
"identify",
"trackEvent",
"trackPage",
"identifyUser",
"reset"
];

for (var i=0; i<methods.length; i++) {
var method = methods[i];
analytics[method] = function(methodName) {
return function() {
analytics.push([methodName, ...arguments]);
}
}(method)
} (method)
}
analytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI");
//analytics.load("1S2kNlbkMrWLBO79H2eNuEST27I", "http://localhost:9090");
</script>
<script src="https://unpkg.com/[email protected]"></script>

//The above is basically the browser.min.js being serviced by cdn, for local
testing, one can refer the js under dist folder

//This marks the end of loading our script, one can wrap the above
in iife if it helps

// Sample calls on global analytics object,
for more examples, refer the tests folder

// The above is basically the browser.min.js being serviced by cdn, for localtesting, one can refer the js under dist folder
// This marks the end of loading our script, one can wrap the above in iife if it helps
```
**Sample events**
```
// Sample calls on global analytics object, for more examples, refer the tests folder
<script type="text/javascript">
analytics.page(
"ApplicationLoaded",
Expand Down Expand Up @@ -86,44 +88,27 @@ Few sample usage of the sdk can be found under **tests** directory for vanilla h
}
);
</script>

```
## Code Structure



- The whole code development is under the **analytics** folder.
# Code Structure

- The whole code development is under the **analytics** folder.
- **analytics.js** handles the core functionality for tapping your **identify**, **page** and **track** calls.

- **integrations** contains the native loading and invocation of different destinations.

- **HubSpot** and **Google Analytics** integrations have been in development recently.



***We try to support both browser and node versions of these integrations. It may so happen that integrations doesn't have a node sdk, in that case routing data through our **data-plane** is one of the options to send data to these destinations*

- The **dist** folder contains the minified and unminified versions of the sdk.

- **tests** contains various flavours for how to use the sdk in applications

- We use *rollup* and *babel* for transpiling and generating the specific builds.



## Contribute

# Contribute

One can start adding integrations like *Mixpanel*, *Facebook ads* and others for sending data through their *js* and *node* sdks.



For building the sdk,



- Look for run scripts in the *package.json* file for getting browser and node specific builds.

- For adding or removing integrations, modify the *imports* in *index.js* under **integrations** folder.
- For adding or removing integrations, modify the *imports* in *index.js* under **integrations** folder.