Skip to content

Instantly share code, notes, and snippets.

@moski
Created June 5, 2018 11:30
Show Gist options
  • Save moski/397cee898353d9760f158ed7ca2e6283 to your computer and use it in GitHub Desktop.
Save moski/397cee898353d9760f158ed7ca2e6283 to your computer and use it in GitHub Desktop.
example gist
var request = require("request");
var options = {
method: 'POST',
url: 'https://trackcmp.net/event',
headers: {
//Add Headers here if needed
},
form: {
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;
}
result = JSON.parse(result);
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