How to send click events from Google Tag Manager to Mautic using the mautic tracking pixel code for a website?

Your software
My Mautic version is: v5.0.2
My PHP version is: 8.0.24
My Database type and version is: MySQL 10.4.34-MariaDB

Your problem
My problem is:
There are limited events avaliable to be captured in Mautic. So, I am using Google Tag Manager for various types of events such as clicks on all the elements on a web page. Once the click event is performed, by using the mautic tracking pixel code, the information from GTM to Mautic is sent. But the event type is shown as Page Hit rather than Click in Mautic.

Steps I have tried to fix the problem:
I created 2 separate tags in GTM: one for Page view and the other for Click.

Page View Tag

<script>
    (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
        w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
        m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://mac.eventassay.com/mtc.js','mt');

    mt('send', 'pageview');
  
</script>

Click Tag

<script>
    (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
        w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
        m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://mac.eventassay.com/mtc.js','mt');

  
    // Add event listener for click tracking
    document.addEventListener('click', function(event) {
        mt('send', 'event', {
            eventCategory: 'Click',
            eventAction: 'click',
            eventLabel: event.target.tagName + ' - ' + event.target.innerText
        });
    });
</script>

hmm… what would you expect to see? There is no notion of page events (like click or scroll) in Mautic as of today; “clicks” refer to links in emails.

(Ab)using page hits to represent GTM events is common practice, imho :slight_smile:
see e.g. https://www.youtube.com/watch?v=tODrdGpDPEY

Thank you for the tutorial.
I have already watched the entire video and got to know that there was an event type called Mautic Event in GTM to create mautic-related events. However, I think GTM has removed the Mautic Event type because I could not find the type while creating a tag. So, the only thing I have right now is the tracking script but I don’t know how to send the parameters that were already provided in the Mautic Event type tags manually through the script.

Not sure it was ever in the official library - you can find it here anyway: GitHub - leoschuler/gtag-mautic-event: Add page view or custom events in Mautic. Recommended to be used to trigger additional events, after initialization of mautic tracking

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.