Rich-text Reply

Track Click event (goal) triggered by jQuery

saggarwal 08-28-15

Track Click event (goal) triggered by jQuery

 

In variation, I have the following code:

 

jQuery("#link_id").click();    //trigger click event from the code

 

in goals, I want to track clicks on #link_id

 

But Optimizely is not tracking the clicks. Any idea why?

 

Sandeep Aggarwal
Certifications, Optimizely
MartijnSch 09-01-15
 

Re: Track Click event (goal) triggered by jQuery

Have you considered using that exact click event and triggering an event in the code of Optimizely as well so you could use that as custom event in the goal settings of your test?
saggarwal 09-01-15
 

Re: Track Click event (goal) triggered by jQuery

In my case, the click event on the Control was tracking fine but not in the Variation because in the Variation, click event was triggered from the code.
Adding the following line of code before raising the click event did the trick:
window.optimizely.push(["trackEvent", "control_click_event_name_here"]);

I guess, you meant the same. Thanks.
Sandeep Aggarwal
Certifications, Optimizely