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. 3 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Hi Carlos

    Thanks for reaching out.

    Perhaps try:

    ga('send', 'event', 'Button', 'Click', 'vmscompare', '1');
    
  2. 3 years, 9 months ago CarlosB

    Hi Andrew,

    Thanks for replying.

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

    Is there anything else I could try?

  3. 3 years, 9 months 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. 3 years, 9 months ago CarlosB

    Hi Andrew,

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

    Thanks for your help

  5. 3 years, 9 months ago Andrew Misplon
    Hi, I Work Here

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

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More