Google analytics 4 event overview
Events in GA4: Now we will use jQuery to extract product information from a Webflow page and post the data to our Google Analytics instance using the gtag.js library.
An event is any action on your website that you may want to record. It may be a user purchase, a product view or a remove from cart. Google Analytics 4 offers powerful event tracking functionality that allows us to customize data that goes into Google Analytics. We will mix our custom event tracking with automatic Google Analytics statistics.
Here in this code snippet we replace THE EVENT with the name of the event we want to send to gtag. For example, if we want to tell Google Analytics that someone viewed a list of items on our site we would replace THE EVENT with Google's provided view_item_list event. We will cover many event types and how we can send these events to Google.
Based on the event we are sending, Google gives us different 'object keys' in the gtag.js documentation to deliver values. The values we send are the product specific information from your website.
It's important to know that these object keys can not be changed.
In this example, we are sending a view_item_list event to Google. With this event, we are sending more meaningful information about items, list name, and list id. We recommend to use the provided object keys that Google gives us in the documentation - items, item_list_name, and item_list_id.
This concept applies to all pages, videos, and implementations of this code.