Tracking button events – Google Analytics


In this article, I will show you how to send event notifications to your Google Analytics account.

OK. In this case, let’s consider the “button” and send the event to GA from it if you have two buttons with different calls to action.

1. Once in the editor, publish the landing page and go to the landings panel by “Go to campaign” button.


2. Open the landing options and click the “JavaScript Code” tab. Here you have to add the Google Analytics code that integrates your landing with GA.


3. If you already have this code in the “JavaScript Codes” tab, go to edit it and check that everything looks properly. If so, save it and go back to the landing editor.


4. In the new window, open Google Analytics for Developers. Once you are there, go to “Web Tracking”.

You will have to choose gtag.js or analytics.js, depends on which script do you use. If you are not sure, check your tracking code, gtag.js looks like this:


and analytics.js is similar to this:


5. Then, select the “Event tracking” tab in the left menu and look at the example tracking code. Copy it and go to your landing page editor.

ga('send', 'event', 'Videos', 'play', 'Fall Campaign');


gtag('event', 'aaa', {
  'event_category' : 'bbb',
  'event_label' : 'ccc'

6. Once you have navigated to the editor, double-click on the button where you want to add the tracking code or go to edit it with the ‘pencil icon’.


7. Go to the “Settings” tab and paste the copied tracking code into the “onClick event” field. Next, adjust the code to the name and function of your button. Here, for example, I changed:

“Videos” –> to “Ebook”;
“Play” –> to “Download”


8. Now adjust the code in the second button by changing its name accordingly to the button. Save and close changes.

‘Videos’ -> to ‘Ebook’;

‘Play’ -> to ‘Learn more’


9. At this point, you can publish your lp. Then open it in the browser by clicking its link. Hover your cursor over one of the buttons, then right-click and open the developer tools.


10. When you look at the bottom of the page, you should see the console. There you can find “onClick event” added before.


11. To follow events directly in your Google Analytics account, move to the side menu, then select the tab “Behavior” -> “Events” -> “Overview”. Here you can analyze all added tracking codes, remember that all the events will show up after about 24 hours.

Was this article helpful?

Can’t find what you need?

Let us help you!
Send us a message
We are using cookies for analytical purpose. Learn more.