Re: Tracking Button Clicks on Webpage

Jack_Wildt
Level 2

Tracking Button Clicks on Webpage

Hello everyone!

We are trying to figure out a way to track button clicks on a webpage for a new campaign. The buttons do things like open a video in a lightbox, or change which competitor we are being compare to, but do link away from the page.

Is there a way to spoof these as link clicks so that we can track them for segmentation/scoring purposes? I am at my wit's end here.

Thank you!

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Tracking Button Clicks on Webpage

The Munchkin API provides the clickLink function specifically for this case, where you want to create synthetic clicks for clickable elements that are not automatically picked up by Munchkin.

If you supply your page URL I can give you an example of how it would be used.

Jack_Wildt
Level 2

Re: Tracking Button Clicks on Webpage

Thank you so much!

On our homepage there are a few videos that open in a lightbox when the play button is clicked, this is one of the things that we would like to track.

https://www.on24.com/

SanfordWhiteman
Level 10 - Community Moderator

Re: Tracking Button Clicks on Webpage

The click on the Play arrow (which isn't a <button>, it's a standard <a>) does get logged by Munchkin already on the page.

pastedImage_0.png

Jack_Wildt
Level 2

Re: Tracking Button Clicks on Webpage

Shoot, that was a poor example on my part.
This is the actual page we are trying to implement it on, https://www.on24.com/wakeupyourwebinars/ . We want to track which competitor buttons they click on in the 2nd section.

Jay_Jiang
Level 10

Re: Tracking Button Clicks on Webpage

A couple of things you'll need to edit on your page.

Add a class, for example "munchkinlink", to the divs that people click on

Add a "data-desc" attribute and the relevant value to the divs

Then add this script to the footer of your page:

$(".munchkinlink").on("click", function(){

Munchkin.munchkinFunction('clickLink', {

        'href': location.pathname + '#' + $(this).attr("data-desc")

    }

);

})