node-deduce-ingest
Deduce's data ingestion.
Installation
Using npm:
npm install node-deduce-ingest
Or get the source:
github.com/deduce-com/node-deduce-ingest
Usage
Configuration
Deduce Ingest requires a Site ID and apikey, provided by Deduce. If you have not been given one, please contact Deduce for more information.
Node module
import Ingest from 'node-deduce-ingest';
var dd = new Ingest('my site id', 'my secret key');
while doing development, you may enable testmode and Deduce will discard the data after validating your requset.
var dd = new Ingest('my site id', 'my secret key', true /* enable testmode */);
Sending Data to Deduce
Use the "html" function to get html code to include in a web page.
var scriptTags = dd.html("user@example.com");
Sending Events to Deduce
function callback(res) {
if ('' !== res) {
console.log('result: ' + res);
}
}
dd.event(user.email, ip, 'account-create', callback,
{additional: {name: user.name, phone: user.phone},
testmode: true});
Depending on the event type, additional data be send by passing an additional hash. You should consult with Deduce support for specific parameters and event types.
Best Practices
-
Only pass information that you have already verified to be valid.
-
Work closely with your Deduce support representative.