Skip to content

Instantly share code, notes, and snippets.

@moski
Created May 31, 2018 10:33
Show Gist options
  • Save moski/de95016d04fd43ad69c0058645d4b0c4 to your computer and use it in GitHub Desktop.
Save moski/de95016d04fd43ad69c0058645d4b0c4 to your computer and use it in GitHub Desktop.
example.js
var request = require("request");
var options = {
method: 'POST',
url: 'https://trackcmp.net/event',
headers: {
//Add Headers here if needed
},
json: {
actid: 23033,
key: "c12973b078007927842301eff932e7d78b74b3e",
event: "YOUR_EVENT",
eventdata: "ANY_DATA",
visit: {
email: ""
}
}
};
request(options, function (error, response, result) {
if (error) { //Fail when firing the request
console.log('CURL failed to run: ' + error);
return;
}
if (result.success) {
console.log('Success! ');
} else {
console.log('Error! ');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment