How to trigger a menu item which is an Anchor Link via Zaraz?

Hi everyone,

I’m trying to trigger a menu item (“Free Demo”) which is an Anchor Link, as I need to track the number of clicks.
foodsafe4u . com

I tried the two triggers below (one as a Match rule and the other one as a click listener) but none of them is working.

I would appreciate it if you could guide me to solve the issue.
Thanks a lot

Hey @proloyalweb, thanks for reaching out to us.

I believe that your first trigger using CSS is missing the “.” or “#” of the selector. You need to tell Zaraz if it should look for a CSS class or ID.

Your second trigger is wrong cause it is looking for the URL path of the document.location and not of the link. So instead, you can do a click listener, using CSS like this:

a[href$='/#freedemo']

I hope this is clearer now.

Thanks a million @yair-dovrat. Both are working well now. :slight_smile: