Reactor.am is the most important from marketing automation, CRM and user analytics, in one easy to use service.
This is a JavaScript client library for Reactor.am API.
Install
$ npm install reactor.am --save
Basic usage
You can use Reactor server side with Node/io.js or client side with Browserify/Webpack.
var Reactor = require('reactor.am');
var reactor = new Reactor({
applicationId: 'YOUR_APPLICATION_ID' // required
});
reactor.collect({
user_id: '661787707', // required
session: 1405587905,
first_name_s: 'John',
last_name_s: 'Doe',
gender_g: 'male',
share_facebook_b: false
});
reactor.event('purchase', {
user_id: '661787707', // required
price_f: 10.30
});
Make sure you provide required fields, Reactor will throw otherwise.
Requests are batched by default. If you want to use it in the browser, you'd probably want to turn this off.
var reactor = new Reactor({
applicationId: 'YOUR_APPLICATION_ID',
batchRequests: false
});
There are more options available that you can set, check documentation.
Documentation
Full documentation can be found at docs.reactor.am
Debugging
Reactor uses debug, set env variable DEBUG
(Node) or localStorage.debug
(browser) to reactor.am*
(logs everything) or reactor.am:requests
(logs
only requests).