Rich-text Reply

Having trouble with click goals after rearrange.

murrell 09-24-15

Having trouble with click goals after rearrange.

I am having a problem tracking clicks when I rearrange a button in the nav bar for instance. If the "contact" button is on the right of the bar in my original and i move it to the left in my variation... When I set a click goal in my variation for the button on the left, it does not track the right button in the original. I'm trying to track clicks on the same button but in different positions. But when I try to track clicks, it tracks the same position on my original and variation which happen to be different buttons. I hope that made sense.

Level 1

JDahlinANF 09-25-15

Re: Having trouble with click goals after rearrange.

Sounds like your click goals are set like:

"the first button" and

"the third button"


So when you move them, the wrong action is credited.


Inistead of binding to "the first" and "the thrid", you need to bind to something that is unique to the button.  Perhaps there is an HTML class or id on the button or the button's wrapper.


If none of this makes sense, and you are allowed, post a link of the page and which buttons you want to make into goals.


Re: Having trouble with click goals after rearrange.

[ Edited ]

Hi Murrell,


I agree with Napoleon's assessment. I'm going to guess that what happened here is that you're having issues with the CSS selector you've used. When you're using the visual editor, Optimizely will use the most precise CSS selector it can find depending on how your website is built. If the element you’re affecting has a Class or ID selector, Optimizely will use that. However, if it doesn’t, Optimizely will follow the CSS path and call the element depending on position in the DOM - "Document Object Model.” If you open a webpage and you Right Click > View Page Source, you’ll see a page of code the HTML tree that the code affects.


QA tip:

If you open up the advanced section of the goals panel, what do you see?


Does it look like this:

.exampleClassSelector or #exampleIDSelector


Or does it look like this:

#MI-52966 > div > div > a.tile3.main09


This second example shows a goal that is dependent on position in the DOM - "Document Object Model."


The reason the above is relevant is because the "Rearrange" tool will take an element out of its position in the DOM and insert it into another position in the DOM. If your goal is based on where that button is located, then the selector used will no longer be valid.


Does that help? Here is an article that explains how to identify your selectors, “jQuery for Non-technical users":




Amy Herbertson
Customer Success