Expand my Community achievements bar.

SOLVED

single click event fires rule twice

Avatar

Level 6

single click event based on CSS selector fires rule twice in Adobe launch. I tried bubbling but didn't work. Any custom code to restrict it to one time firing?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Are you sure the trigger is coming from the same rule?

 

Try turning on debugging... in your Browser's console you can turn on debugging by using:

// Turn ON Debugging
_satellite.setDebug(true);

// Turn OFF Debugging
_satellite.setDebug(false);

 

This should show you which rules are triggering on your click

 

 

The other possibility is that you have multiple Events on the same rule, and multiple of them align to your element:

 

Jennifer_Dungan_0-1694706601111.png

 

 

As in, both "CSS Selector 1" and "CSS Selector 3" match your element, making the rule trigger twice.

 

Example:

  • CSS Selector 1
    • .item1
  • CSS Selector 2
    • .item2
  • CSS Selector 3
    • .item3

 

You can combine CSS Selectors into one big string to simplify this, by using:

  • .item1, .item2, .item3

(You can combine multiple selectors using comma)

 

 

Or you can add a Condition to the rule for "Max Frequency":

 

Jennifer_Dungan_1-1694706742905.png

 

 

Using 1 Second should be enough, as CSS click selectors on the same element will be within milliseconds or one another, and this will allow additional subsequent hits on the same page (if the user isn't navigated away) to continue tracking.

View solution in original post

7 Replies

Avatar

Correct answer by
Community Advisor

Are you sure the trigger is coming from the same rule?

 

Try turning on debugging... in your Browser's console you can turn on debugging by using:

// Turn ON Debugging
_satellite.setDebug(true);

// Turn OFF Debugging
_satellite.setDebug(false);

 

This should show you which rules are triggering on your click

 

 

The other possibility is that you have multiple Events on the same rule, and multiple of them align to your element:

 

Jennifer_Dungan_0-1694706601111.png

 

 

As in, both "CSS Selector 1" and "CSS Selector 3" match your element, making the rule trigger twice.

 

Example:

  • CSS Selector 1
    • .item1
  • CSS Selector 2
    • .item2
  • CSS Selector 3
    • .item3

 

You can combine CSS Selectors into one big string to simplify this, by using:

  • .item1, .item2, .item3

(You can combine multiple selectors using comma)

 

 

Or you can add a Condition to the rule for "Max Frequency":

 

Jennifer_Dungan_1-1694706742905.png

 

 

Using 1 Second should be enough, as CSS click selectors on the same element will be within milliseconds or one another, and this will allow additional subsequent hits on the same page (if the user isn't navigated away) to continue tracking.

Avatar

Level 6

Another issue is when I click a link it fires an event which is fine and in turn, the event takes me to the accordion opened that opening of the accordion fires an event in adobe and it should not fire an event in Adobe because the event is set to fire only on link click. How to tackle this?

Avatar

Community Advisor

In the same rule? Or a different rule?

 

Are you sure there is a rule for Accordion open/close in addition to your clicks?

Avatar

Level 6

Accordions are in different rule. When the different link is clicked it acts as a shortcut for one specific accordion option and since it gets opened adobe considers it as another event.

Avatar

Community Advisor

That one is tricky.. the Max Frequency condition won't work since the triggers are in two different rules... 

 

Now, I don't know your implementation, but do you need the click rule? 

 

One of the things I've worked hard on with our sites is to reduce a lot of the extra server calls from things like clicks... I keep the tracking as lean as possible, using Activity Map (which attached itself to the next page view) as the primary way to track navigation within our sites.

 

If you do need the tracking, I assume that the click is either up the page (and scrolls the user to the accordion and opens it), or the click is on Page A, and the Accordion opening is on Page B.. in either case, you would have to decide which is more important (the click or the accordion - my guess is the accordion) and create rules (either on the Click via CSS selectors to not trigger on specific links that force an accordion to open; or to create some sort of custom code and conditions to restrict tracking the accordion following specific clicks)... 

 

Either that, or you will have to live with the double counting... 

Avatar

Level 6

The accordion events fires only once can you say why? For example 1 fires first time and not second or 3rd time likewise 2 fire first time and 3 fire first time. Again after completing 3 , 1 fires first time.

Below is custom code to grab value.

linkName = "Product Details Tab Click - "+$(this).find("h2").text();
sc.tl(this,"o",linkName);