Example: Creating Google Analytics goal completion custom metrics (with data sources)

 

On July 1, 2023, Google Universal Analytics properties will stop processing data.
Your Google Universal Analytics metrics will no longer be updated with new data. However, your historical data will continue to be stored in PowerMetrics.
Google Universal Analytics has been replaced with Google Analytics 4. Please refer to Google's documentation and our resources page for more information on moving to and working with Google Analytics 4.

 

Our Google Analytics Goal Completions instant metric tracks data for ALL of your goal completions. But, what if you want to create a goal completion metric for a single goal? This article walks you through how to do just that using our query builder!

This article contains the following sections:

What is a goal completion metric and why is it important?

In Google Analytics, you define the user actions you want to track as “Goals”. When a user completes a goal, it’s recorded as a conversion.

The goal completion metric measures the number of conversions (completed actions) within a specified date range. Tracking this kind of data is important because goal completions (such as subscribing to a newsletter or signing up for a trial account) show true intent on the part of the user - potentially one of the most important indicators of your product’s success or failure.

Want to learn more about metrics? Check out MetricHQ, the world’s largest online resource for metrics and KPIs!

Note: This article assumes you’ve already set up goals in your Google Analytics account.

Accessing dimensions and metrics in the Google Analytics API

The Google Analytics Dimensions & Metrics Explorer lists the dimensions and metrics that are available via their API. Click the + button beside Goal Conversions to see information directly related to goals. In this article, the example instructions use the “Goal Completions” data view in our query builder and the “Goal XX Completions” metric. (See below.)

Google Analytics API dimensions and metrics can also be used to query data in PowerMetrics, where they’re available for the following Google Analytics data views: AdSense, AdWords, Ecommerce, Events, GoalCompletions, SiteContent, SiteSearch, SiteSpeed, and Traffic.

How do I create a Google Analytics goal completion custom metric?

The example described in the following set of instructions will result in a custom metric for Google Analytics that tracks the goal completions for a single goal (Trial Registration), segmented by a dimension (Channel Grouping), for a specified time period.

When creating a Google Analytics goal completion custom metric, you will:

  • Find the Profile ID and the Goal ID
  • Define and finalize the query
  • Refine data in the modeller
  • Choose custom metric settings

Finding the Goal ID you want to track

Don’t know the ID for the goal you want to track? In the following procedure, you'll query the Profiles data view to get a list of your Profile IDs. You'll select the Profile ID you want to get data for. Next, you'll query the Goals data view and apply a filter to see only the Goal IDs for the Profile ID you selected. Finally, you'll note the specific Goal ID you want to track.

To find the Goal ID:

  1. In the left navigation sidebar click the + button beside Metrics and select Browse services.
  2. On the Where is your data? page, select Google Analytics.
  3. Click Create a custom metric.
  4. To connect to your Google Analytics data, choose an Account and Account settings and click Get data.
  5. On the Choose data for your data source page, under Data view, click the drop-down and select Profiles.
  6. Under Columns, select the checkboxes beside Id and Name and click Preview data.

A list of all of your Profile IDs and Names displays in the data preview table. (See below.)

  1. In the Id column, copy the Profile ID that you want to use for the custom metric. You’ll need it in step 10. For this example, we’ll copy 5290053.
  2. Next, on the Choose data for your data source page, under Data view, click the drop-down and select Goals.
  3. Under Columns, select the checkboxes beside Id, Name, and ProfileId.
  4. Add a filter to the ProfileId column by clicking the filter button and then the Click to add filter box. Next, select Match All and Equals as the operators, and paste the Profile ID you copied in step 7 as the value. Click the Filter button. Then, click anywhere outside the filter dialog to close it and save the filter. (See below.)

  1. Click Preview data.

The data preview displays all of the goals for the Profile ID we chose in step 7.

  1. In the Id column, note the Goal ID for the goal you want to track. In this example, we want to track “Goal 12” - “Trial Registration”.

  1. Remain in the query builder and follow the next set of instructions “Defining and finalizing the query”.

Defining and finalizing the query

Now, we’re ready to define and finalize the query for our custom metric. In our example, we want to access: Goal 12 (Trial Registration) completions, segmented by Channel Grouping, for a specific date period. To query and get the right data, we’ll select the GoalCompletions data view, choose a few columns, and apply some filters.

To define and finalize the query:

  1. On the Choose data for your data source page, under Data view, click the drop-down and select GoalCompletions.
  2. Under Columns, select the checkboxes beside Date, Dimensions, GoalCompletionsAll, and Metrics.
  3. Add a filter to the Dimensions column by clicking the filter button and then the Click to add filter box. Next, select Match All and Equals as the operators, and enter the dimension you want to segment your custom metric by as the value. (In this example, we entered ChannelGrouping.) Click the + button and click Apply.
  4. Add a filter to the Metrics column by clicking the filter button and then the Click to add filter box. Next, select Match All and Equals as the operators, and enter Goal12Completions as the value. Click the + button and click Apply.

We only want to track data for “Goal 12 - Trial Registration”. By adding, and filtering on, the “Metrics” column, we further define our query to get data for the single goal we want to track.

When entering the filter “value”, make sure you use the correct form, as shown in the Google Analytics Dimensions & Metrics Explorer list. The Google Analytics API format is “ga:goal1XXCompletions”, however, for our filters, we need to remove “ga:” at the beginning. In our example, “GoalXXCompletions” becomes “Goal12Completions”.

  1. Click Preview data.

The Data preview table includes columns for the GoalCompletionsAll, Date, Dimensions (channel grouping), and Metrics (Goal 12 Completions). Right now the column header names aren’t very descriptive but we’ll fix that and make a few more tweaks in the next step - the modeller.

  1. Click Save and continue to go to the modeller, where you will refine your data.

Refining data in the modeller

To refine data in the modeller:

  1. Select the column called Dimensions. Click in the column header and change its name to Channel Grouping.
  2. Select the column called Metrics. On the right side of the modeller, under Column Properties > Data Format, change the data format to Number. Click in the column header and change its name to Goal 12 Completions.
  3. Click Save and continue.

Almost done! Next up - “Choosing custom metric settings”.

Choosing custom metric settings

It’s time to choose the display settings for your Google Analytics goal completion custom metric.

To choose custom metric settings:

  1. In the Metric value step, choose Goal 12 Completions.
  2. In the Segmentation step, select Channel Grouping.
  3. In the Date & time step, select Date.
  4. In the Data shape step, select Periodic summary.
  5. In the Display settings step, leave the settings as is.
  6. Click Save.

You’re done! Find your custom Google Analytics Goal Completions metric in your metric list by clicking Metrics in the left navigation sidebar. Select it from the list to open it. From here you can also add it to a dashboard by clicking the 3-dot menu in the upper-right corner of the page and selecting Add to dashboard.

Want to learn more about our Google Analytics metric options?

Check out these related articles:

Have more questions? Submit a request