WickedReports HTTP POST /clicks XHR
by wickedivan
JavaScript
const testClick = {
"Email": "[email protected]",
"IP_Address": "127.0.0.1",
"Date_Time": "2021-08-25T11:28:44.277Z",
"Timezone": "UTC-0",
"TimeOffset": 0,
"Source": "docs",
"Campaign": "docs",
"Term": "docks-clicks-example",
"Medium": "docks-clicks",
"Content": "docks-clicks-request-body",
"OrderID": "test-order-id-1",
"ConversionType": "UNATTRIBUTED_CLICK",
"WickedId": "",
"WickedSource": ""
};
var data = new FormData();
Object.keys(testClick).forEach(function(fieldKey) {
data.append(fieldKey, testClick[fieldKey]);
});
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function() {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
// TODO: Substitute the <clientname> with your clientname from Wicked Reports
xhr.open("POST", "https://api.wickedreports.com/clicks/<clientnamehere>");
xhr.send(data);