Okay
  Public Ticket #2234779
tracking code using the button element?
Closed

Comments

  • Jason Diceman started the conversation

    Hi, I'm trying to implement a Google Analytics goal tracking to certain buttons on my website. Where can I place the tracking code using the button element? I'll also need this on a "buy now" button in my navigation menu.
    Here is the code: onClick="ga('send', 'event', 'Buy Now, 'Click', 'Buy Now Button', '0');"

  •  3,023
    Andrew replied

    Hi Jason,

    You could add a CSS class to the buttons you want to track that is on the button element add the CSS class to the button settings in the page builder in the extra class name option. 

    Then use custom JS in salient \ general settings - css script related - custom JS to detect the click event on the button using the custom CSS class you added and then run the ga code.

    Hope this helps.