Reading:
Create Google Analytics Event

Create Google Analytics Event

Metamug
Create Google Analytics Event

This article assumes that you are familiar with Google Analytics and Google Tag Manager. In this article, we will see how to create a Click event on a button using Google Tag Manager:

  1. Go to your Google Analytics Dashboard and click on the Triggers from the left side and click on the New button.

2. Create Trigger name like in my case I have given the name “Click Button” and then from the right side click on the icon for configuration.

3. Choose Trigger Type. In the case of the Click event select All Elements option. Just like this:

4. A form will pop up asking you to select options. Choose Some Clicks option. After that new field will appear just after this field asking you to select Button ID, Class, etc. Choose the values Click ID, equals and click-me from the three drop-downs.

After that click on the Save button.

5. From the left side, click on Variables and then click on the Configure button.

6. The Configure Built-in Variables section will appear. Under Clicks heading click all elements.

7. Go back and select the Tag option from the left side and then click on the New button.

8. A form will appear. Enter Tag name as GA- Click Button. Click on the extreme right icon.

9. Under Choose tag type, select Google Analytics: Universal Analytics. This option helps you to link Google Tag Manager to your Google Analytics Account.

10. Select Event from Track Type dropdown. After selecting the Event option, fields will appear like category, action, label. For this example, let us input the following:

Category Action Label
ButtonClick Click click-me

Under the Google Analytics Settings select your Google Analytics id that you have set up while creating the account.

11. Under the Triggering tab, click on the extreme right side icon.

12. A form will appear asking you to Choose a Trigger. Select the trigger that you have just created. In my example, it is a “Click Button”.

Now, you can test your Trigger event by going to your website and clicking on the particular button. And then, check your Google Analytics dashboard to know how many clicks you are getting on the button.

Triggering the event from webpage

Here is the JS snippet showing the Google Analytics (GA) event call:

    ga('send', {
        hitType: 'event',
        eventCategory: 'ButtonClick',
        eventAction: 'click',
        eventLabel: 'click me'
    });

If you want to call the GA event from the server-side, you can find how to do it in this article.



Icon For Arrow-up
Comments

Post a comment