Thanks for previewing Google's new tag documentation! This site is in public beta. (Feedback)

Events

Google 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 global site tag's event command is used to send event data. 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 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 global site tag implementations, 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

  1. In Tag Manager, start a new Google Ads tag. From the home screen select New Tag > Tag Configuration > Google Ads Conversion Tracking.
  2. 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 (tools and settings icon) 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.
  3. 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.)

  4. Choose one or more triggers in the Triggering section to specify when the tag should fire.

  5. Click Save to complete your tag setup.

  6. Preview your changes, and publish when ready.

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 three main types of events represented in Google's tag platform. These can vary from product to product, but generally these can be categorized as: Automatically collected events, recommended events, and custom events.

  1. Automatically collected events are events that are sent from gtag.js or Tag Manager tags with no additional instrumentation on your part. Common examples for automatically collected events include ad_click, page_view, and video_progress. Learn more.

  2. Recommended events are for common measurement scenarios that require additional context in order to be meaningful. Common examples of recommended events include login, purchase, and search. Because they require additional context, they are not automatically sent by Google tags. Learn more.

  3. 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.

gtag.js

Use the gtag('event') command to send a Google Analytics 4 event:

gtag('event', '<event_name>', {<event_params>});

For example, you could use a gtag('event') command to send a generate_lead event:

gtag('event', 'generate_lead', {
  'value': '2',
  'currency': 'USD',
  'transaction_id': '1234'
});

Tag Manager

To send a Google Analytics 4 event in Google Tag Manager, you need two components:

  1. A Google Analytics: GA4 Event tag
  2. A trigger that will cause the tag to fire.

To create a Google Analytics 4 Event tag, refer to the Google Analytics 4 event tag help center documentation.

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:

  1. A Google Analytics: Universal Analytics tag
  2. 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 global site tags 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 global site 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.