If you use Google Analytics and manage your tags in Google Tag Manager, this guide provides a walkthrough on setting up recommended and custom events. By implementing these events, you can gain more granular insights into user interactions taken on your website, enhancing your understanding of user behavior and campaign performance in Google Analytics. Learn more about events
For subtitles in your language, turn on YouTube captions. Select the settings icon at the bottom of the video player, then select "Subtitles/CC" and choose your language.
Before you begin
This guide assumes that you've done the following:
- Create a Google Analytics 4 account and property
- Create a web data stream for your website
- Set up Tag Manager
- Set up Google Analytics in Google Tag Manager
It also assumes that you have the following:
- Access to the Tag Manager container for the website
- The Editor (or above) role to the Google Analytics account
Set up events
To set up an event using Google Tag Manager, you will configure a Google Analytics: GA4 Event tag and then create a trigger that specifies when you want to send the event.
The following steps show you how to send a custom event to a Google Analytics 4 property when a user clicks a button to sign up for your newsletter. The steps show you how to implement the event using Tag Manager and don't require you to implement a data layer object.
Step 1: Create a GA4 Event tag
Start by creating a Google Analytics: GA4 Event tag for the new custom event.
- Go to https://tagmanager.google.com.
- Sign in to your Google Account. Learn how to create a Google Account.
- In Tag Manager, click the Accounts tab (top left), then select your container. Find your way around Tag Manager.
- In the Workspaces tab, go to Tags, then click New (top right).
- Enter a name for the GA4 Event tag at the top (e.g., "GA4 Event - Signup newsletter").
- Select Google Analytics: GA4 Event and configure:
- Measurement ID: Enter your GA4 measurement ID. Where do I find my measurement ID?
- Event Name: Enter a name for the event (e.g.
signup_newsletter
). This will create a new custom event and the name will appear in your GA4 reports. To create a recommended event, use one of the predefined event names. - Optionally, you can add additional parameters to send even more information. See Reuse event settings in Google Tag Manager for instructions and allowed parameters.
Step 2: Create a trigger
Next, create a trigger to send the event when someone clicks the button.
- Click the Triggering box in your GA4 Event tag.
- Click + on the top right.
- Enter a name for the trigger (e.g., "Trigger - Signup newsletter").
You can choose the conditions for sending the event. The following example sends the event based on the button label:
- Click the Trigger Configuration box in your trigger.
- Choose All Elements.
- Click Some Clicks.
- Set the following trigger condition: "Click Text contains Sign up for the newsletter".
- Save all your changes.
If you want the event to trigger when someone views a page (e.g., on a confirmation page), you could use a Page View trigger instead.
Verify and publish
Verify
- Go to https://tagmanager.google.com.
- Sign in to your Google Account. Learn how to create a Google Account.
- Open the Tag Manager container you want to edit. Find your way around Tag Manager.
- In the Workspace tab, click Preview (top right) to launch Google Tag Assistant in a new tab.
- Enter your website URL and click Connect. Learn to debug with Tag Assistant.
Publish
- In the Workspace tab, click Submit (top right)
- In the Submission Configuration section, follow these steps:
- Select Publish and Create Version to publish the changes to your site. To save the changes without publishing them, select Create Version instead.
- Enter a name and description for the version.
- Select Activity History to review the changes you've made since the previous version.
- Click Publish (top right).
See your events in Analytics
You can see your events and their parameters using the Realtime and DebugView reports. Note that the DebugView report requires some additional configuration before you can use the report. These two reports show you the events users trigger on your website as the events are triggered.
Next steps
- Set up event parameters to add more information to your events.
- Reuse event settings in Google Tag Manager
- Mark events as conversions.