CategoryUncategorized

GA & GDS – Regex for Shopify

This is a list of my own helpful Regex strings for Google Analytics & Data Studio. Some examples are specific to Shopify & and some are more generic.

The intended use case is as a RegExp Match filter in GA or similar in GDS.

Limit to product URL’s / paths that exist under a collections URL:

\/collections(.+)\/products\/

This will only show you URL’s like this: https://mydomain.com/collections/top-sellers/products/my-products

Screenshot from Google Analytics showing only Shopify product page paths in collection

In my example above, I wanted to see if a change I made to Shopify theme (to remove these URLs) actually dropped pageviews and landing page hits to those pages. Why I removed them is a separate discussion 🙂

Remove URL parameters (GDS):

I often use this as custom metric within GDS. It’s really a hacky workaround to bring some clarity to dirty GA data to see top pages. I use it to remove weird UTM params like fbclid’s, custom params, yotpo parameters, recommended product referral parameters etc.

REGEXP_REPLACE(Landing Page, '\\?.+', '')
This is a GDS screenshot where I’ve setup a Custom Metric.

Essentially the regex matches part of a string from ? char to anything. So anything question mark and following will be selected, and replaced with ” which is null string, so deleted. So in effect deleting URL parameters. As long as the other metric aggregation is working correctly within GDS they should aggregate okay-ish in GDS, but there are some gotchas, like I with like Ecom Transaction Conversion %’s adding by default which is not correct.

See home page only in Google Analytics

Seems like it should be simple, to filter to home page only but adding a simple text filter contains=’/’ to GA will show you all pages not just the home page.

URL parameters from uncleaned GA data can complicate this. Especially if you want to use logic like; match these:

/
/?
/?something
/?p=something

But not these:

/page/page
/page/page?param=something
/products/product-slug?p=something
/collections/collection-name/?k=sdflksjdf909&rjnrid=1NqVnVx

So I’ll use a RegExp like this in GA to filter to home page only:

^\/$|^\/\?

List of interesting Tech SEO links

I made this list purely out of interest because there is some great Technical SEO content out there that is under-rated and I wanted to do more justice than a bookmark 🙂

A perspective on .htaccess based redirect performance implications and why you should maybe not use .htaccess for redirects:
https://www.danielmorell.com/guides/htaccess-seo/basics/dont-use-htaccess-unless-you-must

An interesting case-study on the impact on how JS-heavy content can affect crawl-rate and using SSR to fix:
https://dev.to/kunnendavid/how-to-get-250k-pages-indexed-by-google-57ep

Some nice ideas around Edge SEO use-cases:
https://dantaylor.online/edge-seo/

MERJ technical SEO roundups are consistently great- eg:
https://merj.com/blog/technical-seo-roundup-january-2020

This alternative approach to dynamic XML sitemap structure to improve crawl rates.
https://ohgm.co.uk/an-alternative-approach-to-xml-sitemaps/

How to write for People Also Ask (PAA)

snip from a Google SERP on “types of rice” showing the People also ask feature

This is a quick summary for my own reference around how to write.

TLDR;

  • Write complete questions and answers. Make sure that each question is asked and answered fully.
  • Use plain language.
  • Avoid sales language.
  • Add Q&A schema.

Answer the question

  • Be concise, and answer upfront
    • You usually only have ~3 sentences to fit an answer into (look at how many words/chars are in some example answers).
    • Make the first half of the first sentence the answer, then elaborate.
  • Meet the search intent
    • Yes/No question, answer Yes/No. If there is more complexity, then elaborate. “Yes, but” is better than no answer at all.
    • numerical question – give a numerical answer
    • time/date question – give a time/date answer
    • price based question – give a $xxx answer or a range, or a from $x

© 2020 Kieran Reid

Theme by Kieran ReidUp ↑