Showing posts with label Google Search Console. Show all posts
Showing posts with label Google Search Console. Show all posts

Friday, 1 April 2022

Regex Differs Between Google Analytics and Google Search Console

If you're working with both Google Analytics and Google Search Console you've probably tried at some stage to get your head around regex. Regex is brilliant and is well worth investing time into getting to know. It's used by numerous platforms, but does vary a little from platform to platform.

However, Google takes things a step further. Regex is different on Google Analytics than it is in Google Search Console. 

This is particularly noticeable if you're trying to filter your search by URL and want to use markers to tie your needle to either the start or the end of the URL. Ordinarily you use a caret ^ to tie your search term to the start of the available text (or line), and a dollar sign $ to tie to the end. But Google complicates this.

So for Google Analytics if you want to find only those pages ending in your search term you use the $. If you want to make sure that this comes straight off the homepage you only need to include the caret - no need to refer to the stem. So if your domain is https://www.datageek.com using
^/news/$
Will find solely https://www.datageek.com/news/, no sub pages and not others like https://www.datageek.com/someothersection/news/

To do the same in Google Search Console though seems to want you to account for the variations in the stem, So to do the same as the above in Search Console you have to use
h.*datageek\.com/news/$
You would think Google would just choose one, but apparently not...