• Resolved UmbrellaWeb

    (@umbrellaweb)


    We have recently took over a site which uses monster insights. It had a pretty old version of your plugin.

    Now prior to updating some links had this onclick attached:

    onclick="ga('send', 'event', { eventCategory: 'Phone', eventAction: 'Click-to-Call', eventLabel: 'Clicked'});"

    That was populating in GA with the event category of phone…

    After updating to the latest monster insights that is now no longer tracked.

    We have read the docs you have on tel links and thats fine BUT still need the above working and its not.

    As an example the site has other onclick events similar to the above which have also stopped working.

    Do we need to change the : onclick=”ga TO onclick=”gaTeracker for this to work???

    We need to setup multiple events of our own (which were previously setup and working fine)

    To fix I tried going back to an old version 7.13 (oldest I could go back to) but that hasnt fixed he issue….

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author chriscct7

    (@chriscct7)

    Hmm, that snippet you have shouldn’t have worked with our old version (because we used __gaTracker not ga as the name of the analytics object) but should work with our new one (because we alias both ga and __gaTracker to gtag in our compatibility layer in our new version).

    Changing it it __gaTracker should resolve the issue though we’d highly recommend instead of using onclick, using our link attribution api since it’s designed to be future proof and adds some additional handling over just onclick firing: https://www.monsterinsights.com/docs/custom-link-attribution/

    -Chris

    • This reply was modified 3 years, 8 months ago by chriscct7.
    Thread Starter UmbrellaWeb

    (@umbrellaweb)

    Thanks for the quick reply chris…

    OK, so your saying IF I use that code:
    onclick="gaTracker('send', 'event', { eventCategory: 'Phone', eventAction: 'Click-to-Call', eventLabel: 'Clicked'});"
    (with version 7.13 upwards) it will work and will record in GA with the labels assigned. So If i go to event category I should be able to find Phone (or whatever I have assigend).

    I have tested that but nothing in rela time came through. Will check back I guess in a day or so to see if its populated over time (should have worked with real time though IF you are saying the code should work).

    Re the API, that looks great. Need to read up on that and test and implement I guess. Didnt realise that was avliable!

    Plugin Author chriscct7

    (@chriscct7)

    You need to use __gaTracker (with the two underscores) for it to work in either the old or the new version.

    Thread Starter UmbrellaWeb

    (@umbrellaweb)

    @chriscct7 great all working as expected now. Much appreacited ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘onclick ga’ is closed to new replies.