Example: Creating Google Analytics goal completion custom metrics (NEW)

 

We’re improving the metric creation experience. Our recent redesign lets you preview changes while you create and edit 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 you're in the right place. If not, go to this article instead.

 

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 data feed editor
  • 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 New custom metric.
  2. Click Select data feed.
  3. On the Select a data feed page, click + New data feed
  4. Click Select data.
  5. On the Where is your data? page, select Google Analytics.
  6. If this is your first time connecting to Google Analytics, choose an Account and Account settings and click Get data. If you've connected to Google Analytics before, we assume you want to use the same account. Skip to the next step.

Note: If you want to connect to a different Google account or use different account settings, click the account tile in the top right of the Choose data for your metric page (in the next step).

  1. On the Choose data for your metric page, under Data view, click the drop-down and select Profiles.
  2. 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 metric 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 + button and then click Apply. (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 metric 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 data feed editor.

  1. Click Save query to go to the data feed editor, where you will refine your data.

Refining data in the data feed editor

To refine data in the data feed editor:

  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 data feed editor, 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 data feed.

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. Under Measure, select Goal 12 Completions.
  2. Under Date and time, select Date.
  3. Under Data structure, select Use latest values per period.
  4. Under Segmentation, select Channel Grouping.
  5. Click Save metric.

You’re done! Your custom Google Analytics Goal Completions metric opens in its homepage. To add it to a dashboard, click the 3-dot menu in the upper-right corner of the page and select Add to dashboard. Your metric is also added to your list of metrics (accessed by clicking Metrics in the left navigation sidebar). 

Video example

In the following video, we create a goal completions metric and then take it up a notch, using a simple formula in the modeller (now called the data feed editor), to include more than one dimension.

Note: We're always working to make PowerMetrics better and better. After this video was recorded, we added the new homepage for metrics and consolidated raw and modelled data sources into a single object called data feeds. We also added a live preview so you can see the impact of changes before saving the final version of a custom metric. As a result, some parts of this video don't reflect the current UI. However, it still includes a lot of super-helpful content, especially when choosing data in the query builder (which hasn't changed) and refining it in the modeller/data feed editor.

Want to learn more about our Google Analytics metric options?

Check out these related articles:

Have more questions? Submit a request