Click events in Launch using div id | Community
Skip to main content
Level 2
March 9, 2021
Solved

Click events in Launch using div id

  • March 9, 2021
  • 1 reply
  • 5505 views

Hi,

 

I'm looking to tracking click interaction with elements on my homepage using CSS selectors.

 

I can see the option for a rule in Launch based on click but unsure what syntax to specify under "Elements matching the CSS selector".

 

The selector I'll be looking for interaction on is <div id="addButton"> or <div id="minusButton">.

 

Thanks,

James

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 Brian_Johnson_

@jmaguire-1 -

It's just looking for a basic selector, the same you would use with document.querySelector() or document.querySelectorAll(). For the two DIVs in your question, since they have unique IDs (at least, the IDs should be unique on the page), you can use #addButton and #minusButton, respectively.

 

More on selectors here.

1 reply

Brian_Johnson_
Brian_Johnson_Accepted solution
Level 8
March 9, 2021

@jmaguire-1 -

It's just looking for a basic selector, the same you would use with document.querySelector() or document.querySelectorAll(). For the two DIVs in your question, since they have unique IDs (at least, the IDs should be unique on the page), you can use #addButton and #minusButton, respectively.

 

More on selectors here.

Level 2
March 9, 2021

Thanks @brian_johnson_, managed to get to work.
How would I go about passing the name of 'Add' or 'Subtract' to Analytics, ie. Add used, to the custom link report?