Pinterest Event data-Post

Following function can be used to send event data

sendEventData(data, authorization) {
				console.log(" authorization in data ", data);
				console.log(" authorization in sendEventData ", authorization);
				var xhr = new XMLHttpRequest();
				xhr.withCredentials = true;
				xhr.addEventListener("readystatechange", function () {
					if (this.readyState === 4) {
						console.log("Response Status:", this.status);
						console.log("Response Text 3:", this.responseText);
					}
				});

				xhr.open("POST", "https://api.pinterest.com/v5/ad_accounts/xxxxx/events?test=true");
				xhr.setRequestHeader("Authorization", authorization);
				xhr.setRequestHeader("Content-Type", "application/json");
				xhr.setRequestHeader("Cookie", "_auth=0; _pinterest_sess=fggfdvdvv==; _ir=0");
				xhr.send(JSON.stringify(data));
			}

Leave a comment

Your email address will not be published. Required fields are marked *