-2

Setting up a goal in GA for my eCommerce store.

My products are all direct from the main URL without the /products/ segment so I cant id them on GA. (e.g. they all look like this www.abc.com/baby-food)

Product pages: www.abc.com/word-word-.. and may include special characters. Examples:

/captain-america-novelty-case
/mathematics-psle-revision-guide-3rd-edition
/pregnancy-day-by-day-3rd-edition#cxrecs_s

How do I use a single expression to id product page from the rest?

Examples of other pages from my site:

/shop/study/2018-study-necessities/prepare-for-school/general-materials
/shop/read/books/parenting
/Class/SearchResults/0/ALL 
/articles
/shop 
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Emily Chu
  • 1
  • 1

1 Answers1

1

Based on the examples you gave, what I see is that product pages all have several words in the 1st path level (before second /), so I would try something like this:

^/[a-z0-9]+-[a-z0-9]+

This will match urls which start with /word1-word2 and can be followed by any substring.

In addition to setting up a goal, you might want to use content groups too: https://support.google.com/analytics/answer/2853546?hl=en&ref_topic=1727167

To exclude certain words, you can try this: A regular expression to exclude a word/string

Not sure if GA supports this syntax, you have to test

Max
  • 12,794
  • 30
  • 90
  • 142
  • Hello. I realised there are also specific /word1-word2 URLs I need to exclude. Do you think there is any expression that can exclude these few unique scenarios..? Thanks a lot. – Emily Chu Apr 14 '18 at 07:23