I’ve set up button tracking using Mixpanel and I’m unsure why I’m not seeing any events now it’s live.
I’ve used Javascript with a HTML embed on the page with the buttons:
<script type="text/javascript">
$(document).ready(function() {
$('[cta-button]').click(function(e) {
var buttonname = $(this).attr('cta-button');
var page_name = document.title;
mixpanel.track('ctaClick', { buttonname: buttonname, page_name: page_name });
});
});
</script>
Custom attribute is set to:
where data-script=“true”
An example button Custom Attribute: cta-button=“main-cta”.
While we have the Mixpanel tag set up on the page using Google Tag manager.
Can anyone help with this?