[Tip] Pulling Google Analytics segments into a data source

I love Google Analytics segments. They are one of the useful tools in your web analytics toolkit. The story of your web performance often involves a bit of digging to surface (sometimes) unexpected insights. Not familiar with segments? Check out Google's Segment Doc.

Did you know that you can pull custom segments into your Google Analytics data sources using Klipfolio? It's pretty simple.

When you're creating a Google Analytics data source follow these steps:

  1. Use the GA data connector
  2. Instead of using Simple Mode, select Advanced mode
  3. Once in Advanced Mode, click the Google Analytics Query Explorer link.
  4. Familiarize yourself with the Query explorer (this may take a minute).

The explorer is a powerful way to access data. I generally prefer this method because it provides more advanced options. Simple mode is great for getting started, but we want to go under the hood a bit more, right?

You'll immediately notice options you may be familiar with: metrics, dimensions, and date options. You will also notice advanced options like the ability to sort, filter, and apply segments.

To apply a segment, just click the Segment region. You will notice all your segments appear in a nice, neat list for you to peruse.

Pretty cool, huh?

The next step is to bring the query back into Klipfolio to create and save the data source. Copy the Query URI to your clipboard, and switch back to Klipfolio.

You will want to edit the query a tad to adjust the time period pulled in via the API call. The GA Explorer defaults to a static data selection (between Jan 1 and Jan 25), which means once you create the data source, no new data will populate. 

In Klipfolio's advanced mode, you can edit the query. A neat hack you can use is to set the time frame in simple mode, switch the advanced mode, then import the query to get the correct date parameters. Just copy those to Notepad for future use.

Next, I'll paste the Query API into Klipfolio, do a bit of editing to get the data parameter working, and Viola! We have a data source that pulls a segment.

Hope this is helpful!


Please sign in to leave a comment.