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

SOLVED

Launch track link page

Avatar

Community Advisor

Read

Hello everyone,

 

Any suggestion how to track li with href?

 

 

1982luca_0-1605513120645.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Luca_Lattarini - If you're looking to track clicks on the <a> tags that are found in your list, you can do this with a Launch rule. Your rule, with CSS selector, may look something like this:

evolytics_brian_1-1605559989417.png

Using "div#dashboard-deals li a" will pick up any/every <a> tag that falls under a <li> inside your div. This assumes the following page structure (from your image):

...
...
  <div class="collapse" id="dashboard-deals">
    <ul>
      <li><a href="/someLink1.html">some text 1</a></li>
      <li><a href="/someLink2.html">some text 2</a></li>
      <li><a href="/someLink3.html">some text 3</a></li>
      <li><a href="/someLink4.html">some text 4</a></li>
    </ul>
  </div>
...
...

From there, you'd set up the rest of your rule as you normally would.

 

0 Replies

Avatar

Community Advisor

Are you saying that inside the <li>, there is no <a> element?

Avatar

Community Advisor
Yes, i have this <a href="">XXX<a/>

Avatar

Level 1

Can you add an event listener to it?

Avatar

Correct answer by
Community Advisor

@Luca_Lattarini - If you're looking to track clicks on the <a> tags that are found in your list, you can do this with a Launch rule. Your rule, with CSS selector, may look something like this:

evolytics_brian_1-1605559989417.png

Using "div#dashboard-deals li a" will pick up any/every <a> tag that falls under a <li> inside your div. This assumes the following page structure (from your image):

...
...
  <div class="collapse" id="dashboard-deals">
    <ul>
      <li><a href="/someLink1.html">some text 1</a></li>
      <li><a href="/someLink2.html">some text 2</a></li>
      <li><a href="/someLink3.html">some text 3</a></li>
      <li><a href="/someLink4.html">some text 4</a></li>
    </ul>
  </div>
...
...

From there, you'd set up the rest of your rule as you normally would.