Google Analytics 4 custom events are valuable tools to help you monitor the key actions taking place on your website. When you integrate Google Analytics 4 with PowerMetrics, you get access to an even more robust and informative set of analytics to visualize and track your data as it evolves over time.
In this example, we’ll show you how to connect PowerMetrics to your Google Analytics 4 account. You'll then learn how to use the query builder in PowerMetrics to retrieve custom event data and create a data feed you can use for your custom Google Analytics 4 metrics.
Note: This article describes how to create a metric for an event that tracks the completion of a sign-up form. However, you can apply the same principles when creating metrics for all of your Google Analytics 4 custom events.
This article contains the following sections:
- Finding your events in Google Analytics 4
- Connecting PowerMetrics to your Google Analytics 4 account
- Creating your query and finalizing your data feed
- Creating your metric
Finding your events in Google Analytics 4
In Google Analytics 4, you'll find events in the Reports section at Engagement > Events. You can refer to this information to verify your data as it displays in PowerMetrics. See below for an example of data for the sign_up_form_completed event that we’ll be tracking in this article:
Now that you know what data we’ll be tracking, let’s connect PowerMetrics to your Google Analytics 4 account.
Connecting PowerMetrics to your Google Analytics 4 account
When you connect to your source data and bring it into PowerMetrics, you create a data feed. Data feeds combine your account connection (the service account you’re logged into that has the data for your metrics) and your data (as a visual component you can view and edit). Learn more about data feeds.
To connect PowerMetrics to your Google Analytics 4 account:
- In the left navigation sidebar, click the + button beside Data Feeds.
- Click Select data.
- On the Where is your data? page, select Google Analytics 4.
- If this is your first time connecting to Google Analytics 4:
- Click Add new account.
- Enter your Google Analytics 4 login credentials and click Allow to enable Klipfolio PowerMetrics to securely access your Google Analytics 4 data.
- Next, to further define the data you're looking for, under Choose account settings, select your Analytics Account and Property or App from the drop-down lists. Click Use account.
- Click Add new account.
- If you’ve connected to Google Analytics 4 before, we assume you want to use the same account and take you directly to the next step - Creating your query and finalizing your data feed. If you want to connect to a different account, you can do so in the query builder by clicking the account connection at the top of the data preview window (see below). You can either select an alternate, existing account or click “Add new account”.
That's all there is to it! You're connected and ready to move on to creating a query and finalizing your data feed.
Creating your query and finalizing your data feed
After connecting your account, the query builder opens. You'll start by choosing a data view. Using that data view, we'll run a query to get a list of available columns from within it. You'll then choose from those columns (and add filters) to specify the data to include in your data feed.
To create your query and finalize your data feed:
- Under Data view, click the drop-down and select Engagement.
The Engagement data view contains the data for the events you’re tracking in Google Analytics 4. Its contents should mirror what you see in the Engagement tab in Google Analytics 4.
The following screenshots display the UI for "engagement" and "events" for Google Analytics 4 and for PowerMetrics.
Engagement and events in Google Analytics 4:
Engagement and events in the PowerMetrics query builder:
- Under Columns, select the checkboxes for the columns to include in your data feed. In this example, we'll select EventName (for the name of the event), EventCount (for the counts of those events), and Date (for the date on which the events took place). You can also select any additional text columns you’d like to include as segments in your metric.
- To track the sign_up_form_completed event, you need to filter the data being retrieved. Click the filter button for the EventName column. Then, click the Click to add filter box, select Equals as the operator, and enter sign_up_form_completed as the value. Click the Filter button. Then, click anywhere outside the filter dialog to close it and save the filter. (See below.)
- You can, optionally, increase or decrease the range of data being returned by applying a filter to the Date column. (The default date range is the last 30 days.)
Go here if you want to learn more about filtering in the query builder.
- Click Preview data.
Note: Once you have a data preview table, you can optionally apply filters to column headers there (instead of in the left sidebar). Some people prefer that method as they can more easily see their data.
- Click Save query.
The data feed editor displays.
- In the data feed editor, you can rename the data feed. By default, it's automatically named to match the query. In our example, that's "GoogleAnalytics4Engagement".
This step is optional but it might help you find the data feed later when you want to use it for your custom metrics.
- Click Save data feed.
Your new, saved data feed displays. You're ready to use it to create a custom metric.
Creating your metric
To create your metric:
- In the data feed you just saved, click +Add metric. (See below.)
Note: If you accidentally closed the data feed, you can reopen it from your list of data feeds (accessed by clicking Data Feeds in the left navigation sidebar.)
- Under Measure, select EventCount. This is the column from your data feed that contains the values you want to track in your metric.
- Under Historical data, enable the Data feed contains historical data toggle and select the Date column. This is the column from your data feed that contains the date/time associated with each value.
- Click the Settings tab.
- Under Date handling, select Use most recent values only > for each day. Your choice determines the data points your metric will use when calculating the metric value for a time period.
- Under Format, select Numeric.
- Under Favourable trend, select Trending up is positive.
- Under Default aggregation, select Sum.
- Click the About tab.
- Under Name, enter Completed Sign-Up Forms.
- Click Save metric.
Your Google Analytics 4 "Completed Sign-Up Forms" custom metric is added to your list of metrics (accessed by clicking Metrics in the left navigation sidebar). As its data feed gets refreshed, new data is added to your metric, enabling you to see trends and compare your data to previous periods.
Note: Depending on the time zone set in your PowerMetrics account, you may notice slight differences between the metric's value in PowerMetrics when compared to what's shown in Google Analytics reports. This article explains why and describes how to easily correct this difference.