Home>Support>Button Tracking (Onclick)

Button Tracking (Onclick)

Hi,

I’m trying to set up event tracking in Analytics for button clicks.

In the OnClick field I’ve entered the following; ga(“send”, “event”, “Button”, “Click”, “vmscompare”, “1”);

No matter what I try I can’t get the event to record in Analytics (Realtime or otherwise)

The page URL is https://eleymet.com/digital-height-gauge/

The Button Name is ‘How does the VMS Compare’

Analytics is working and other tracking is working perfectly.

Can you advise what I’m doing wrong?

Thanks

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 14 days, 1 hour ago Andrew Misplon Hi, I Work Here

    Hi Carlos

    Thanks for reaching out.

    Perhaps try:

    ga('send', 'event', 'Button', 'Click', 'vmscompare', '1');
    
  2. 8 days, 1 hour ago CarlosB

    Hi Andrew,

    Thanks for replying.

    I’m afraid your suggestion hasn’t worked either.

    Is there anything else I could try?

  3. 8 days, 1 hour ago Andrew Misplon Hi, I Work Here

    You can perhaps try setting up a test button on a page not using Page Builder to see if that’s working.

    <button onclick="ga('send', 'event', 'Button', 'Click', 'vmscompare', '1');">Button</button>

    https://www.w3schools.com/jsref/event_onclick.asp

  4. 8 days, 1 hour ago CarlosB

    Hi Andrew,

    Thanks for coming back again. I’ve managed to find a workaround using a plugin.

    Thanks for your help

  5. 8 days, 59 minutes ago Andrew Misplon Hi, I Work Here

    Sure, no problem. Glad to hear you’re making progress :)

Please log in to post on our forums. Signing up is free.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More