How to count the number of clicks on banners on your site

First of all, we will explain how to measure the number of clicks for each banner in Google Analytics.

If you navigate to a site on a different domain that is not related to your site, that behavior cannot be measured.
Therefore, if you click on a banner on an affiliate site and go to an external site, you will not know how many clicks the banner has received.

However, if you set up event tracking, you will be able to measure it.
It’s not complicated, just add a line or two to your HTML code!
Once you are able to measure the number of clicks on your banners, you will be able to see the difference when you change the position, content, and size of your banners.

What is event tracking?

Event tracking is a feature that allows you to measure behaviors that cannot be measured by Google Analytics in its default settings without URL transitions.
Actions that cannot be measured by Google Analytics include, for example
Clicking on a link to an external site
Clicking a phone button
Downloading a PDF file
and so on.

In this way, you can measure actions that do not involve page transitions (called events) and set them as goals. These are called events and can be measured and set as goals.

Measure banner clicks with event tracking!

Let’s take a look at how to measure banner clicks. The work required is very simple.

onclick=”ga(‘send’, ‘event’, ‘sidebar’, ‘click’, ‘banner’,1 );”
That is in the a tag of the banner. Open the html code of the page and add the following description.

For example
<a href="" onclick="ga('send','event','banner','click','image', 1);"><img src="banner.jpg" /></a>

onclick=”~~”: This is one way to write JavaScript. It says to execute ~~ when it is clicked.
ga(‘send’,’event’,~): This is a description of an event that will be measured and sent to Google Analytics.
banner: The name of the event category (the group of data to be measured). There are no specific rules, so give it a name that is easy to understand. In the example, the number of clicks on the banner, so we use banner.
click: The name of the event action (the name of this action). Like the name of the event category, give it a name that is easy to understand. We use “click” because it counts the number of clicks.
image: The name of the event label (the data to be measured).
It’s a good idea to make sure that you know which banner the label is for.
After adding the code, it will take a day or two for the clicks to actually be recorded, so wait a bit.

Check how it works in Google Analytics!

After you have installed the code, check to see if it is actually recording.

From the Google Analytics report screen, click on “Behavior”, then “Events”, then “Pages” in that order.
You can check the event occurrence status of each page.

Total events: The total number of events that occurred.
Number of unique events: An indicator that does not count duplicates of the same event (events with the same category, action, and label).
If the same event occurs multiple times in one user session, it will be considered as 1 unique event.
Event value: The sum of the values set for an event.
It is calculated as “the value set for the event” x “the number of times the event occurs.

What if I want to measure more easily?

Set a shortened URL to your link.

For example
<a href=""><img src="banner.jpg"/></a>

This way, you can easily get the click count.