Tags are designed to give you the ability to instrument your web pages and mobile applications to send data when some kind of event occurs. This data can include information about the type of event and parameters that describe information about the event.
What is an event?
An event is when a user interacts with a component of your website. These events can include (but are not limited to):
- Web page loads
- Link clicks
- Form submissions
- Video plays
- Purchases
- Subscriptions
- App installs
What is a parameter?
Parameters are data that are associated with an event. Examples of parameters include:
- Item value
- Coupon codes
- Login method
- Transaction ID
- Currency
Events and parameters can tell you much about what your customer preferences are, and can help you answer questions such as: What product pages get the most views? What buttons get clicked more frequently? What campaigns lead to purchases or subscriptions?
The event
command
The event
command (used with the Google tag) sends event data to Google
advertising and measurement products. The
prototype for an event
command is as follows:
gtag('event', '<type>', {<parameters>});
<type>
is the type of event, such as a Google Ads conversion event or a Google
Analytics 4 event name. <parameters>
is an object of name/value pairs that
contains data that describes the event.
Events in Tag Manager
Events in Tag Manager are configured based on the tag type that is in use. For example:
- Conversion events for Google Ads are sent with the Google Ads Conversion Tracking tag.
- Events in Google Analytics 4 are configured via the Google Analytics: GA4 Event tag.
- Events for Universal Analytics tags are configured in the Google Analytics: Universal Analytics tag via the Track Type setting.
- Floodlight events are configured with either the Floodlight Counter or Floodlight Sales tags.
Tag Manager uses triggers to specify what events to track and listens to your webpage or mobile app for that event to occur. When the event occurs, the tag fires and sends data to the specified product.
Google Ads conversions
Google Ads conversion events measure activity after a user interacts with an ad. These conversions can represent events that result in things like new subscriptions, purchases, or app downloads. Before you get started with this tag, we recommend that you learn more about how this feature works in the Google Ads help center.
To set up your Google Ads conversion tags, you will need to enter the required Google Ads Conversion ID and Conversion Label, and an optional Conversion Value, Currency Code, and/or Transaction ID.
gtag.js
For implementations of the Google tag, events are sent with gtag('event',
'conversion'...)
. For example:
gtag('event', 'conversion', {
'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
'value': 1.0,
'currency': 'USD',
'transaction_id': '12345',
});
Tag Manager
- In Tag Manager, start a new Google Ads tag. From the home screen select New Tag > Tag Configuration > Google Ads Conversion Tracking.
- Sign in to your Google Ads account to gather the values that you will
use to complete the tag setup:
- In your Google Ads account, click the Tools and Settings
(
) menu.
- Select Measurement: Conversions, which opens to the Conversion Actions table.
- Select the name of the conversion that you want to use from the Conversion action column.
- Expand the tab for Tag setup to view the tag details.
- Select Use Google Tag Manager.
- Copy the Conversion ID and Conversion Label.
- In your Google Ads account, click the Tools and Settings
(
In Tag Manager, add the required Conversion ID and Conversion Label values obtained from step 2 to their respective fields. You may optionally add a Conversion Value, Transaction ID, and Currency Code. Be sure to use Tag Manager variables for these field values whenever applicable. (For example, most cases will use a variable for Transaction ID.)
Choose one or more triggers in the Triggering section to specify when the tag should fire.
Click Save to complete your tag setup.
Learn more about how to set up Google Ads conversions.
Google Analytics 4 events
In Google Analytics 4 properties, every measurable user action is considered an event. Events can be page loads, link clicks, form completions, the addition of an item to a shopping cart, checkout, page scrolls, video views, app installs, and so on. Google Analytics 4 events support custom parameters and user properties, which makes Google Analytics 4 very flexible for how you measure activity.
There are four main types of events represented in Google's tag platform. These can vary from product to product, but generally these can be categorized as follows:
Automatically collected events are events that are sent from gtag.js or Tag Manager tags with no additional instrumentation on your part. Common examples of automatically collected events include
ad_click
,page_view
, andvideo_progress
. Learn more.Enhanced measurement events are events that are sent from gtag.js or Tag Manager tags when you enable the events within Google Analytics. Common examples of enhanced measurement events include
scroll
,click
, andfile_download
. Learn more.Recommended events are for common measurement scenarios that require additional context in order to be meaningful. Common examples of recommended events include
login
,purchase
, andsearch
. Because they require additional context, they are not sent automatically. Learn more.Custom events are events that you define. These events are not already automatically collected or recommended events. In practice, you should try to use automatically collected events or recommended events whenever possible, and only use custom event types when the former types do not meet your requirements. Learn more.
To learn how to set up an event for gtag.js or Google Tag Manager, see Set up events.
Universal Analytics events
Universal Analytics events are based on the legacy event/category/label/value model.
gtag.js
Use the gtag('event')
command with the following syntax:
gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
});
The following sends an event with an action of 'Downloads'
, a category of
'MP3'
, and a label of `'Debussy - Clair de lune':
gtag('event', 'Downloads', {
'event_category' : 'MP3',
'event_label' : 'Debussy - Clair de lune'
});
If <category>
or <label>
are omitted, they will be set to the default
values of (not set)
.
Tag Manager
To send a Universal Analytics event in Google Tag Manager, you need two components:
- A Google Analytics: Universal Analytics tag
- A trigger that will cause the tag to fire.
To learn more, read the Universal Analytics tag help center documentation.
The Universal Analytics event information is structured as follows:
Name | Type | Default Value | Description |
---|---|---|---|
<action> | string | The value that will appear as the event action in Google Analytics Event reports. | |
<category> | string | "(not set)" | The category of the event. |
<label> | string | "(not set)" | The label of the event. |
<value> | number | A non-negative integer that will appear as the vent value. |
Read the anatomy of Google Analytics Event parameters for more information on how the structure of events is interpreted by Google Analytics.
Floodlight activities
"Floodlight activities" are conversions that correspond to specific events you’d like to measure, such as the completion of a purchase or a visit to a webpage. When a user performs the action after seeing one of your ads, that's called a conversion. Learn more.
gtag.js
Floodlight activities are sent from the Google tag via
gtag('event','conversion')
. This code should be placed after the gtag()
function is defined, preferably within the <head>
section for optimal
performance.
Fields of data are sent as a string of parameters in the send_to
property. The
fields are different depending on the tag type, counting method, and other data
you’re passing into the tag.
Here's an example of a Floodlight conversion activity:
gtag('event', 'conversion', {
'allow_custom_scripts': true,
'u1': '[variable]', // custom Floodlight variable
'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+[countingMethod]'
});
Learn more about how to use the Google tag with Floodlight activities.
Tag Manager
Google Tag Manager can be used to set up Floodlight activities. Read the help center documentation for more information.