Re: Clicked Link Tracking - Modal Links

JD_Nelson
Level 10 - Community Advisor

Clicked Link Tracking - Modal Links

we embedded a lightbox video on our homepage using a modal link, but I'm not sure how/if I can track (using munchkin) who's clicking it? Ideas?  I tried standard 'link name is' and 'link name contains' but no results.

Tags (1)
5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Clicked Link Tracking - Modal Links

Pls post your URL.  Depending on how the modal is launched (i.e. pure JS on a non-link element) Munchkin may not attach to the link, so you have to trigger clickLink ​in code.

JD_Nelson
Level 10 - Community Advisor

Re: Clicked Link Tracking - Modal Links

<a data-target="#ag-modal-hero-home" data-toggle="modal" data-thevideo="https://www.youtube.com/embed/XYZ" class="Video_link"><span style="color:#fff;">Watch Video</span></a>

SanfordWhiteman
Level 10 - Community Moderator

Re: Clicked Link Tracking - Modal Links

Put a synthetic href on that link, for example

     href="?watch-video=XYZ"

That's the quick-and-dirty way to get it picked up. If you need to combine the main document's query string with the video info you'll need to do a little more.

JD_Nelson
Level 10 - Community Advisor

Re: Clicked Link Tracking - Modal Links

adding that in the <a> tag sent us to that 'link' after clicking. Is there a better place to put it, or way to make in inactive?

SanfordWhiteman
Level 10 - Community Moderator

Re: Clicked Link Tracking - Modal Links

Your modal code really should already be doing this, but add

     return false;

to the modal handler if not.

(Anytime you attach to A tags you should assume they have a default action, which you can ignore using Event#preventDefault or in this basic case return false;).