Example: Tracking Google Analytics 4 events in PowerMetrics (with data sources)


We’re improving the metric creation experience. Our recent redesign lets you preview changes while you create custom metrics. We’ve also combined raw and modelled data sources into a single object called a data feed.
If you see Data Feeds in the left navigation sidebar, go to this article.
These new features are being released gradually. If you don't see them in your account yet - no worries - they’re coming soon!


Google Analytics 4 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 event data and create a modelled data source you can use for your custom Google Analytics 4 metrics.

Note: This article describes how to create a metric that tracks standard Google Analytics 4 events. If you want to create metrics for specific custom Google Analytics 4 events go to this article instead.

This article contains the following sections:

Note: You can find our full list of Google Analytics 4 resources here.

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 page_view, one of the events 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

To connect PowerMetrics to your Google Analytics 4 account:

  1. In the left navigation sidebar, click your Account Name > Data Sources.
  2. Click the Create a New Data Source button.
  3. On the Where is your data? page, select Google Analytics 4.
  4. If this is your first time connecting to Google Analytics 4, click Add new account.

  1. Enter your Google Analytics 4 login credentials and click Allow to enable Klipfolio PowerMetrics to securely access your Google Analytics 4 data.
  2. 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.

  1. 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 modelled data source. 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 modelled data source.

Creating your query and modelled data source

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 modelled data source.

To create your query and modelled data source:

  1. 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:

  1. Under Columns, select the checkboxes for the columns to include in your modelled data source. 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). 

Note: The EventName column includes information for various events, for example, session_start, user_engagement, and page_view. By adding EventName to the query (and, subsequently, the modelled data source) you’ll be able to filter the resulting metric by each of these event types to visualize their related data.

When querying data for your modelled data source, you can select additional text columns to include as segments in your metric or numeric columns you could use to make other metrics later on. For example, we also selected TotalUsers and EventCountPerUser, which we can use as the measure for other metrics in the future, using the same data source. (See below.)

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

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

  1. Click Save and continue.
  2. On the Modify Data page, you can rename the modelled data source. By default, it’s automatically named to match the query. In our example, that’s “GoogleAnalytics4 Engagement”.

This step is optional but it might help you find the data source later when you want to use it for your custom metrics.

  1. Click Save and exit to save your modelled data source.

The details page for the modelled data source displays. You're ready to use it to create a custom metric.

Creating your metric

To create your metric:

  1. On the details page for the modelled data source, click Create metrics.

The Create a custom metric page displays. This is where you'll choose the settings for your metric.

Note: If you closed the modelled data source, you can reopen it by selecting it from your list of data sources (accessed by clicking your Account name > Data Sources in the left navigation sidebar).

  1. In the Metric value step, choose EventCount. This is the column in the modelled data source that contains the values you want to track in your metric. Make sure the default aggregation is set to Sum. Click Next. (See below.)

  1. In the Segmentation step, select EventName and, if applicable, any other columns by which you want to be able to segment and filter your metric value. Click Next.

  1. In the Date & time step, choose the Date column from your modelled data source. Click Next. (See below.)

  1. In the Data shape step, select Periodic summary > Day. Click Next. (See below.)

  1. In the Display settings step:
  • Under Metric Name, enter Google Analytics 4 Events.
  • Under Format, make sure the data format is Numeric.
  • Under Favourable trend, select Trending up is positive.
  1. Click Save.

Your Google Analytics 4 Events custom metric is added to your list of metrics (accessed by clicking Metrics in the left navigation sidebar). As its modelled data source gets refreshed, new data is added to your metric, enabling you to see trends and compare your data to previous periods. When viewing your metric, you’ll be able to filter by any of the fields you’ve segmented your metric by, for example, the page_view event mentioned previously. (As shown below on the metric’s homepage.)

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.

Have more questions? Submit a request