Creating Advanced Segments in Google Analytics

Wednesday, 10 October 2009

“Primary key phrases” are the lynchpin of our clients’ online marketing campaigns. The organic position of these phrases is the strongest KPI we (and our clients) use to measure the success of a campaign. But rankings aside, how much traffic do these primary key phrases (or PKPs) actually generate? We can also ask, “Does the traffic convert?”, “Are visitors interacting with the site?”, but for now I just want to focus on how PKP traffic can be accurately (and quickly) measured. After all, a website isn’t there just to look pretty, it’s there to generate business.

How to create a PKP traffic advanced segment

Open your Google Analytics account and select Advanced Segments.


Select  +Create new customised segment.


To create your segment, drag and drop your chosen dimensions into the statement boxes. The two you need to select are both under Traffic Sources: Keyword and Medium.

Drag Keyword into the first statement box and choose Matches regular expression from the Condition drop-down menu. Value is where you insert the key phrases, but we’ll add these in a moment.

Choose Add “and” statement, and drag Medium into the second statement box. Choose Matches exactly from the Condition drop-down menu, and choose Organic from the Value drop-down. This is what it should look like:


Now we need to add the primary key phrases in the Value box of the Keyword statement. The easiest way to do this is with a text editor capable of regular expressions such as Ultra Edit, as you need to add carat, pipe and dollar symbols to separate the key phrases.

Open the text editor and paste in your primary key phrases.

Now you need to place a ^ symbol before each key phrase and a $ symbol afterwards. In between each key phrase there needs to be a |. So it will look like this:

^keyword one$|^keyword two$|^keyword three$

To do this, go to the Search menu and select Replace. You need to replace ^p with $| and tick Regular Expressions. Then select Replace All. This is what it should look like in the replace wizard:


Now you need to replace $| with $|^ and untick Regular Expressions. Then choose Replace All again.

Make sure there is  a ^ before the first key phrase, and a $ after the last key phrase so that it looks like this:

^keyword one$|^keyword two$|^keyword three$

Now that you’ve added the symbols, select all and copy and paste into the Value box in the Keyword statement box in Analytics.

The last thing to do is name your segment e.g. Client PKPs and select Create Segment. And that’s it. Now you have a quick, easy way to measure a really important KPI.