Using the Multi-Channel Funnel Reporting API to retrieve data for your dashboard
Published 2023-03-21
Summary - The Multi-Channel Funnel Reporting API is a powerful tool to harness the power of that data, whether you're building reports in Klipfolio or any other 3rd party tool. In this post, I provide an overview of the API along with some tips and tricks to get started.
The Multi-Channel Funnels report in Google Analytics is one of the most useful reports for online marketers. This report sheds light on the paths that a visitor may take on his or her way to completing a goal on your website. This report is an essential part of understanding visitor behaviour in the long term, and to optimize your conversion process based on that behaviour. For example, you can see the percentage of conversions that visit your site through a combination of referral, search, and direct channels. In my example, you can see only 0.79% of conversions interacted with all 3 channels.
There are a lot of great resources out there to learn more about Multi-Channel Funnels. Here are a few I recommend:
- Google Analytics Multi-Channel Funnels
- Google Analytics Demystifies Visitor Behavior With Multi-Channel Funnel Reports
- Understanding Google Analytics Multi Channel Funnels
Using the Multi-Channel Funnel Reporting API
The Multi-Channel Funnel Reporting API lets you extract raw data from Google Analytics to do with as you please. For Klipfolio customers, that means creating a data source to create visualizations for your business dashboard; for everyone else, it may mean creating a custom in-house report or using it within your own application. I'm going to provide a walkthrough of crafting and executing a GET request using the Multi-Channel Funnel Reporting API, and what you do with that data is completely up to you. Before starting, I recommend checking out the official overview: What is the Multi-Channel Funnels Reporting API - Overview
Crafting a query using the Multi-Channel Funnel Reporting API
I'm going to use the Google Analytics Multi-Channel Funnel API Explorer to craft the query. Before you start crafting your query, make sure you authorize the request by clicking the button at the top-right of the workspace.
I'm going to walk you through completing 4 important tasks to successfully craft a query using Multi-Channel Funnel Reporting API:
- Retrieving your Analytics ID
- Setting the date range
- Selecting metrics for the query
- Selecting dimensions for the query
Step 1: Retrieving your Analytics ID
You will need to enter the table ID for the web property/website from which you want to retrieve data. The table ID for a website can be found by opening Google Analytics and viewing the website in question. The ID is located at the end of URL in the address bar, and is highlighted in red in the following example:
- https://www.google.com/analytics/web/?hl=en#report/bf-overview/a987654w33445561p12345678
Once you have this ID, enter it into the Table ID field.
Step 2: Setting the date range
You can do quite a bit using date ranges, and I recommend checking out Google's docs on date parameters. You can also edit date ranges using functionality in Klipfolio, if you're so inclined (Docs). My preference is to use a dynamic or rolling date range which will return data over a set period up to and including today's date. To do that, I will enter 30daysAgo in the start-date and today in the end-date.
Step 3: Selecting metrics for the query
Metrics are a required parameter for any request you process using the Multi-Channel Funnel Reporting API. I like to think of metrics as providing the raw values for the query you process, and dimensions (more below) as describing the data in more detail. The Multi-Channel Funnel Reporting API uses unique metrics, which can be found in the Dimensions & Metrics Reference. To include a metric in the explorer, just copy the title of the metric from the table of contents at the top of the page or at the individual list of the value, and paste it into the appropriate field. Multiple metrics can be added by separating them with commas.
Step 4: Selecting dimensions for the query
Dimensions are an optional, but very important parameter to include in your query. Dimensions describe the data and provide context for the values you are looking at in the data set. For example, dimensions can be used to return additional data about the source path, medium path, keyword path, and much more. Just like metrics, copy the title of the parameter and paste it into the explorer. Use the Dimensions & Metrics Reference to find dimensions that are relevant to your analysis.
What to do with the query
This query can be used in a variety of ways. Depending on how you are going to use the query, you may need to include an API key in order to correctly process your GET request. Think of an API key has a secret handshake between you and Google Analytics, and sharing that handshake lets Google know it's safe to process the request on your behalf.
Using the MCF Reporting API to create data sources in Klipfolio
The query you've just crafted can be plugged into Klipfolio to create visualizations for your business dashboard. You can use the query that is spit out in the explorer, but you need to exclude the &key={YOUR_API_KEY} parameter from your query. That's because Klipfolio uses OAuth to verify your credentials, rather than an API key.
Sample Queries
You can use these queries to create a data source in Klipfolio; all you need to do is replace the {profileID} with your own ID.
- This query returns the source, medium, and date for visits and conversions. An example of this may be, "wikipedia.org / referral" or "google / cpc".
- https://www.googleapis.com/analytics/v3/data/mcf?ids=ga%3A{profileID}&start-date=30daysAgo&end-date=today&metrics=mcf%3AtotalConversions&dimensions=mcf%3AsourceMediumPath%2Cmcf%3AconversionDate
- This query builds upon the previous query by adding the goal number. Each goal you set up in Google Analytics has a number associated with it, which allows you to see what types of conversions are occurring through the multi-channel funnel.
- https://www.googleapis.com/analytics/v3/data/mcf?ids=ga%3A{profileID}&start-date=30daysAgo&end-date=today&metrics=mcf%3AassistedConversions&dimensions=mcf%3AsourceMediumPath%2Cmcf%3AconversionDate%2Cmcf%3AconversionGoalNumber
Conclusion
APIs in general are a powerful tool for extracting or pulling raw data from your favourite web services. Google's been kind enough to publicly expose APIs to many services such as Google Analytics, and components of those services such as the Multi-Channel Funnel Reporting API. Data-driven marketing means that analytics is a priority, and every tool in your kit makes a difference. Hopefully this post helped shed some light on this very cool tool.
>