In my external website (which is a react application) on click of a button (sign up button), I need to send marketo email. When I embed marketo form, enter data in the form and submit, lead is getting associated in marketo. Email is also getting triggered by smart campaign. However as per my UI requirements, I can't have marketo form in my page. I am trying out the approach mentioned here -https://developers.marketo.com/blog/merge-anonymous-visitor-activity-when-visitor-fills-out-form/ I am calling munchkins associateLead function when a button is clicked in my page. Following is the code: document.addEventListener("click", function (event) {
if (event.target.id === "SignUP") {
Munchkin.munchkinFunction(
"associateLead",
{
Email: decodeURIComponent("myemail%40gmail.com"),
FirstName: decodeURIComponent("Saurabh"),
LastName: decodeURIComponent("Mehta"),
},
"my_api_private_key"
);
}
});
})(); But in the network tab I could see 401 invalid request token error. Here is the request URL in network tab - http://myinstance.com/webevents/associateLead?_mchNc=1587141013155&_mchKy=secret_api_key&_mchAtEmail=fname.lname78%40gmail.com&_mchAtFirstName=Saurabh&_mchAtLastName=Mehta&_mchId=some_id&_mchTk=_mch-localhost-15864149018-50069&_mchHo=localhost&_mchPo=3000&_mchRu=%2F&_mchPc=http%3A&_mchVr=158&_mchEcid=& What am I missing here? I am really stuck at this point. Really appreciate any inputs on this issue.
... View more