Expand my Community achievements bar.

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
Level 8

@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.

 

View solution in original post

5 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
Level 8

@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.