Track interactions on your website with GA4

For the past few weeks, Google Analytics 4 has completely replaced Universal Analytics. You may have encountered some difficulties while tracking visitor interactions on your website. Here are our tips to better understand the tool.


What is an event?

An event allows you to measure a specific interaction or occurrence on your website or in your application. For example, you can use an event to measure page loading, clicks on a link, purchases, or to measure system behavior.


To set up an event we recommend using Google Tag Manager, you need to configure a Google Analytics tag: GA4 Event, and then create a trigger that specifies when to send the event.

The following steps explain how to send a custom event to a Google Analytics 4 property when a user clicks on a button to subscribe to your newsletter.


Step 1: Create a GA4 Event Tag Start by creating a "Google Analytics: GA4 Event" tag for the new custom event.

  1. In Google Tag Manager, click on Tags > New.

  2. Give a name to the GA4 event tag at the top (e.g., "GA4 Event - Subscribe to Newsletter").

  3. Select Google Analytics: GA4 Event.

  4. In Tag Configuration, select your Google Analytics: GA4 Configuration tag.

  5. In Event Name, enter the event name (e.g., signup_newsletter). A custom event will be created, and the name will appear in your GA4 reports. To create a recommended event, use one of the predefined event names.



Step 2: Create a Trigger Next, create a trigger to send the event when a user clicks the button.

  1. Check the Trigger box in your GA4 event tag. Click on + at the top right.

  2. Give a name to the trigger (e.g., "Trigger - Subscribe to Newsletter"). You can choose the conditions for sending the event. The following example sends the event based on the button's label:

  3. Check the Trigger Configuration box in your trigger. Select All Elements. Click on Some Clicks. Set the following trigger condition: "Click Element matches CSS Selector 'Subscribe to Newsletter'". Save all your changes. If you want the event to trigger when a user views a page (e.g., a confirmation page), then use a "Page View" trigger.

  4. Preview mode allows you to test the changes made to your container before publishing them on your website.



What types of events exist?

We have selected a few interactions that could be useful to you:

  • event : Trigger when a user...

  • signup_newslette : subscribe to newsletter

  • ad_impression : sees an advertisement (for apps only)

  • generate_lead : submits a form or information request

  • login : logs in

  • purchase : makes a purchase

  • search : performs a search on your website or in your application

  • select_content : selects content on your website or in your application

  • share : shares content from your website or application

  • add_payment_info : provides payment information during checkout

  • add_shipping_info : provides shipping information during checkout

  • add_to_cart : adds items to the cart

  • add_to_wishlist : adds items to the wishlist

  • begin_checkout : starts the payment process

  • remove_from_cart : removes items from the cart


For more information, feel free to contact us.

Previous
Previous

Demystifying AI for Business Growth

Next
Next

Unlocking the Secrets of Blockchain: Top Recommended Resources for Aspiring Learners