Google Analytics: Track Traffic from Google My Business When Using Yext

So, you wanna be able to identify traffic from Google My Business when you’re looking at your stats in Google Analytics. But you also happen to be using Yext. And, of course, Yext appends a parameter (y_source) to your URL in order to be able to track the traffic not only from your Google My Business listing but from all other sites in the Yext network, as well.

Bad solution

You could add utm_ parameters to your URL in Yext (e.g. utm_campaign=Google My Business). The trouble with this solution is that your utm_ parameters will then be used on every site in the Yext network. So, traffic from Yelp, Bing Maps, Apple Maps, etc. will appear to have come from your Google My Business listing. Not good.

Good solution

Give up trying to track traffic from your Google My Business listing in Google Analytics.

Just kidding. 😉 Of course there’s a good solution to this challenge that actually achieves the results you want.

For our solution, we’re going to create an advanced filter that identifies traffic from Google My Business and then sets the “campaign” dimension to “Google My Business”.

Navigate to the filter configuration screen

In Google Analytics, go to the “Admin” area. Select the account, property, and view where you want to track Google My Business traffic.

Click “Filters”

Click the red “+ ADD FILTER” button

Select “Create new Filter”

Name the filter

I recommend naming the filter “Identify Google My Business with Yext Parameter”.

Select the “Custom” filter type

Select the “Advanced” filter type

Set “Field A -> Extract A”

Under the “Field A -> Extract A” section, select the field named “Campaign Source”. Then, in the input field, enter:

google

As you no doubt guessed, “Campaign Source” represents the website that referred the traffic (e.g. google). Specifically, it’s the “source” (as in e.g. utm_source=google).

Set “Field B -> Extract B”

Under the “Field B -> Extract B” section, select the field named “Request URI”. Then, in the input field, enter:

.*y_source.*

“Request URI” represents the part of the referring URL that follows the hostname. Specifically, it contains the combination of the path and parameters.

In case you’re curious about the dots (.) and asterisks (*), Advanced Filters use regular expression matching in fields A and B.

Our regular expression “.*y_source.*” matches any character any number of times (.*), followed by “y_source” (the parameter Yext adds to the URL for tracking purposes, followed by any character any number of times (.*). In other words, this part of the filter looks for “y_source” somewhere in the Request URI.

Set “Output To -> Constructor”

Under the “Output To -> Constructor” section, select the field named “Campaign Name”. Then, in the input field, enter “Google My Business”.

If the Campaign Source matches google\.com and the Request URI matches .*y_source.*, then the Campaign Name will be set to “Google My Business”.

Set field requirements and overrides

Check the boxes to require fields A and B, as well as to override the output field.

Save the filter

Remove Yext parameter from URLs

This step is optional, but helps clean up your data in Analytics. Since the Yext parameter “y_source” is only there for tracking purposes, it’s typically desirable to remove that parameter from your Analytics data.

Without making any adjustments, traffic to your home page from Google My Business will show up in Google Analytics as something like:

/?y_source=1_MTYwMjR1MDUtNzE1LWxvY2F1aW9uLndlYnNpdGP=

Obviously, that’s not ideal. This is home page traffic, not traffic to some page with a really long string of random characters.

So, if you’d like Analytics to show this home page traffic as actually being home page traffic…

Create another filter

Name the filter

Name the filter “Remove Yext Parameter from URL”.

Select the “Custom” > “Search and Replace” filter type

Select the “Request URI” filter field

Set the “Search String”

Use the following regular expression:

[?&]y_source=[^&]+

Save the filter

Make sure the new “Search and Replace” filter is ranked below the “Advanced” filter

Filters are applied in the order in which they are ranked. Think of “rank” as “order”. So, the filter ranked “1” is applied first, the filter ranked “2” is applied second, and so on. If you’ve created your filters in the order we’ve gone through in this post, then everything should be good to go.

The end result

Before

After

A few things to keep in mind

It can take up to 24 hours for your filter to start working. So, if you don’t see results right away, give it a day or so and then check again.

Also, remember that filters only apply to data received after the filter is applied. So, if you create the filter today, it will only affect your Analytics data from today and after. Data received before the filter was applied won’t be affected.

Finally, use filters cautiously. Once a filter is applied and the data is run through it, there’s no going back. That data is permanently altered. Always test your filters on a view set up specifically for testing before applying filters to a view used for analyzing traffic.

Subscribe to Learn More Google Analytics Secrets

1 thought on “Google Analytics: Track Traffic from Google My Business When Using Yext”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.