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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

DTM - Attach click even to a link that doesn't have ID

amine74235389
Level 2
Level 2

Hi,

I have a page that has a link. Unfortunately the link does not have an ID and I can't add one (technical issues with CMS). I have jQuery/JS code that can listen for the link click and fire a pixel, but I'm not sure how to create the rule in DTM.

The jQuery is something like this:

$("a").click(function(){

    if($("a").attr('data-utc')=="12345")
       //Fire pixel    
});

Any idea how to create such custom rule in DTM?

1 Accepted Solution
ParitMittal
Correct answer by
Level 10
Level 10

Hi Amin,

For your Use-case you can create  Create an Event based rule with Event type as "Click" and "Element or Tag Selector"  as  a and Please check the box to manually assign properties & attributes and then specify the attributes with their value. Please see the below snapshot for more help.

Thanks & Regards

Parit Mittal

View solution in original post

2 Replies
ParitMittal
Correct answer by
Level 10
Level 10

Hi Amin,

For your Use-case you can create  Create an Event based rule with Event type as "Click" and "Element or Tag Selector"  as  a and Please check the box to manually assign properties & attributes and then specify the attributes with their value. Please see the below snapshot for more help.

Thanks & Regards

Parit Mittal

View solution in original post

amine74235389
Level 2
Level 2

I used the above with regex and it worked. Thank you.