Skip to main content
Khushboo_Kalia
Adobe Employee
Adobe Employee
Jan 5, 2022 12:06 PM UTC
Solved

adobe.target.trackEvent() failing while getOffer() is working

Hi,

I am trying to track some CTAs and I am using trackEvent method for that. But when I am clicking on the button, the request goes into 400 status.

The workaround to this I opted is to go for getOffer() method but just curious to see the reason behind failure of trackEvent method. Any help will be much appreciated. thanks!

Below is the code - 

 

el.addEventListener('click', function (e) { e.preventDefault(); console.log("CTA clicked") adobe.target.trackEvent({ "mbox": "carouselCTA" }); // adobe.target.getOffer({ // "mbox": "carouselCTA", // "success": function (offer) { // adobe.target.applyOffer({ // "mbox": "carouselCTA", // "offer": offer // }); // }, // "error": function (status, error) { // console.log('Error', status, error); // } // }); setTimeout(function () { window.open(el.href, '_blank'); }, 1000); });

 

Target version - 2.3.2

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Gaurav_Singh_02Accepted solution
Adobe Employee
Jan 7, 2022 9:56 AM UTC

@khushboo_kalia  the code seems to be fine. I have seen such issues related to the browser extensions or network settings.

Hope this helps.

5 replies

Gokul_Agiwal
Community Advisor
Community Advisor
Jan 6, 2022 2:09 PM UTC

Hi @khushboo_kalia 

I tried the below code at my end seems is working fine for me with target version 2.7.0. 

const el = document.getElementByClassName("hero_btn")[0]; el.addEventListener('click', function (e) { e.preventDefault(); alert("CTA clicked") adobe.target.trackEvent({ "mbox": "carouselCTA" }); setTimeout(function () { window.open(el.href, '_blank'); }, 1000); });

 

I can see there was some issues with version 2.1.0 for trackEvent function however that got fixed in later release so shouldn't be the problem. 

 

If still having problem then it's worth to try to upgrade target version in lower environment and check again. 

Hope this helps. 

Translate
Thanks, Gokul
Khushboo_Kalia
Adobe Employee
Adobe Employee
Jan 18, 2022 10:31 AM UTC

@gokul_agiwal thanks for your response. I'll try upgrading the version.

Translate
Gaurav_Singh_02Adobe EmployeeAccepted solution
Adobe Employee
Jan 7, 2022 9:56 AM UTC

@khushboo_kalia  the code seems to be fine. I have seen such issues related to the browser extensions or network settings.

Hope this helps.

Translate
Khushboo_Kalia
Adobe Employee
Adobe Employee
Jan 18, 2022 10:26 AM UTC

@gaurav_singh_02 That seems the issue but I couldn't tackle which extension that will be in my case.

Translate
Gokul_Agiwal
Community Advisor
Community Advisor
Jan 18, 2022 10:35 AM UTC

Hi @khushboo_kalia Sometimes Adobe experience cloud debugger (old) browser extension make an issues with so just try disabling and see if that works for you. 

Translate
Thanks, Gokul