adobe.target.trackEvent() failing while getOffer() is working | Community
Skip to main content
Khushboo_Kalia
Adobe Employee
Adobe Employee
January 5, 2022
Solved

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

  • January 5, 2022
  • 2 replies
  • 2295 views

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.
Best answer by Gaurav_Singh_02

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

Hope this helps.

2 replies

Gokul_Agiwal
Community Advisor
Community Advisor
January 6, 2022

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. 

Khushboo_Kalia
Adobe Employee
Adobe Employee
January 18, 2022

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

Gaurav_Singh_02Adobe EmployeeAccepted solution
Adobe Employee
January 7, 2022

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

Hope this helps.

Khushboo_Kalia
Adobe Employee
Adobe Employee
January 18, 2022

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

Gokul_Agiwal
Community Advisor
Community Advisor
January 18, 2022

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.