Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

As we're quickly taking off into 2023, our Adobe Target Product teams want to hear your top interest areas for learning opportunities and value realization with Adobe Target ~ to fill out the survey with your suggestions, experience, and feedback, follow the link to the right.

Tracking button clicks using alloy.sendEvent not increasing conversions

Avatar

Level 2

Hi All,

I have setup a custom code in one of the activities to fire a custom mbox and I am trying to track that in the conversion settings as viewed an mbox and selecting the parameters passed in audience refinement and checking the value. But it does not increase any conversions for the clicks happening , but If i try by clicked an element and set that as a metric the conversion does happen.

the custom architecture 

<script>

var btn = document.querySelector('button.efe-cta-primary');
  btn.addEventListener('click', function(){
  try{
  alloy("sendEvent", {
  renderDecisions: false,
  data: {__adobe: {target: {"clicked": "getStarted"}}},
  decisionScopes: ["click-mbox"]
  });
  }catch(err){
   //console.log("Error",err);
  }
  })
  </script>
and this is the settings in the conversions 
tarun_jamana8469_0-1671608559330.pngtarun_jamana8469_1-1671608590922.png

and I also see the interact call firing and the data being sent as payload in the network tab 

tarun_jamana8469_2-1671608760271.png

can anyone help me with why the conversions are not incrementing. Thanks in Advance

3 Replies

Avatar

Level 6

Hi @tarun_jamana8469,

How is the HTML markup structured? Does the button have an href attribute? Maybe this is already the problem from the timing point of view.

Avatar

Level 2

Actually it is a button inside a form which has an onclick event on it which has some function which which gathers all the fields from it and then takes some time to redirect to the other page

Avatar

Level 6

What else I notice about the script. I don't know when exactly it is executed. But what can also be possible is that the script executes right at the page load via target - but at this time the button does not yet exist in the DOM.