Reg Expression, Handling a URL exclusions - regex

I am trying to write a regexp to use with Crazyegg that will allow me to only gather data from my product pages.
My site structure is:
category page: www.sitename.com/categoryname/sub-categoryname
product page: www.sitename.com/productname/
My regex so far is:
^https?://([A-Za-z0-9.-]*\.)?sitename\.com/[A-Za-z0-9.-]*(/|/\?|)$
This allows everything that isnt at the sub category level (2nd level folder?)
the issue is that this allow top level categories so I need to exclude these by their name for example:
^https?://([A-Za-z0-9.-]*\.)?sitename\.com/(?!\babout\b|\bcheckout\b)(/|/\?|)$
Could you please help me get the exclusion correct? ive also tried doing using [^\babout\b|\bcheckout\b]

if you only want product pages, the regex for capture product pages is:
".*productname"
For capture category pages: ".*categoryname/sub-categoryname"
I hope help you. If you have more questions, ask me!

Related

Google Analytics Advanced filter to Combine / merge multiple instances of URL? Find & Replace UTM parameters

I'm looking to use Advanced Filter Search and Replace on GA to combine all url instances of my blog page (multiple UTM parameters)
so Urls like the following:
/blogs/in-the-garden/diy-garden-bar-ideas-for-summer?mc_cid=etc.....
/blogs/in-the-garden/diy-garden-bar-ideas-for-summer?fbclid=etc.....
I want to filter as:
/blogs/in-the-garden/diy-garden-bar-ideas-for-summer
This is the plan for my filter:
Request URI
Field A: ^(/blogs/in-the-garden/diy-garden-bar-ideas-for-summer)(?).*
Request URI
Output To: $A1
Is this written correctly? I'm new to Reg Ex
You can exclude that parameter from the View settings, you don't need a filter:
However, as XTOTHEL says, the change will work from the day of saving onwards, not for historical data.
Note: fbclid is not an UTM parameter. It comes from Facebook posts link.
Real UTM parameters (utm_source, utm_medium, ...) are automatically removed from Google Analytics
Data that's captured in GA already WON'T BE AFFECTED by the filters. They're not retroactive.
If you want to remove fbclid then use the query string parameter exclusion feature: https://support.google.com/analytics/answer/1010249?hl=en

What RegEx code do I need to leave something as-is

I have a list of page names such as below:
Homepage
Product 1
Accounts
Sign In
Product 2
Campaign
Product 3
I want to use a calculated field in Google Data Studio to aggregate all Product pages. How would I write the code so that it still includes the other pages without manually inputting each individually? This is the code I have:
CASE
WHEN REGEXP_Contains ( Page Title, 'Product' ) THEN "Product Page"
ELSE [LEAVE AS IS]
END
What code would I write to leave the page title as-is but still including it? I feel like it's either something so simple or impossible and that's why I've been unable to find any answers. Would really appreciate any help!
I would guess just this:
CASE WHEN REGEXP_Contains ( Page Title , 'Product' ) THEN "Product Page" ELSE Page Title END

Combing two referral links into one using filter in Google Analytics

I have two referral urls that come from an email campaign and I'd like to combine them under referrals. The links are:
links.ssa.gov
links.govdelivery.com
So I set a search and replace filter with the following regex. The search string is:
.*links\.ssa\.gov.*|.*links\.govdelivery\.com.*
and I'd like to replace them with the replace string 'govdelivery_emails'
The two referral links are still showing up though. Is my regex done correctly?
Generally speaking...anytime regex is needed in a filter, an Advanced filter does a better job of producing the desired result than a S&R filter. There are exceptions, of course, but I will not go into specifics here.
Here are the Advanced filter settings I would use for this scenario:
1) Field A -> Extract A
Field: Campaign Source
Match Pattern: (links.(ssa.gov|govdelivery.com))$
2) Field B -> Extract B
leave empty
3) Output To -> Constructor
Field: Campaign Source
Output Pattern: govdelivery_emails
Field A Required: yes
Override Output Field: yes
These filter settings should work for you.

Using regular expressions on google analytics goal funnels?

I want to create a goal funnel on Google by using regualar expressions:
for example lets say the website is www.example.com
and the funnel journey should be
1. Category Page i.e. /brands/nike
2. Product Page i.e. /brands/nike/nike-air-trainers
3. Checkout i.e /checkout/onepage/success/
How can u write in this regular expression, the reason Im asking this is how will google differentiate between the category page and a product page?
1. Category Page i.e. /brands/nike - regex: /brands/[^/]+
2. Product Page i.e. /brands/nike/nike-air-trainers - regex: /brands/[^/]+/(.+)
3. Checkout i.e. /checkout/onepage/success/ - regex: /success/ or /checkout/[^/]*/success/

Opencart: i need to search any product inside subcategories

I'm trying to create a menu with buttons that can filter products by main categories
This query url finds products inside a category:
/index.php?route=product/category&path=61
i can find only a part of products with a subcategory search.
/index.php?route=product/category&path=61_72_73
I need to NOT LINK products with their category parents, so is there a way to search with a subcategory filter?
I tried something like this:
/index.php?route=product/category&path=61&sub_category=true
But this doesn't work, it works only with textual searches like this one:
/index.php?route=product/search&search=chair&category_id=61&sub_category=true
ModelUse 'Advanced Product search for OpenCart'. You can search sub categories and any filters you add (including custom ones) with it.
http://www.opencart.com/index.php?route=extension/extension/info&token=460e88e8227b9d7e80466e026dbe1f64&extension_id=13605
I use it for a car dealer website with filters like year, make, model (and sub categories of those) etc and it works great for me.
Here's a demo link:
extension demo link
Try
index.php?route=product/search&search=%25&category_id=25&sub_category=true
25 is category id (which is not mandatory)
and search=searchterm is for a sting search in all sub categories
search=%25 means all products
search field name has changed at some of past version try this for 1.5.4.1
index.php?route=product/search&filter_name=%25&filter_category_id=20&filter_sub_category=true
and see here
http://demo.opencart.com/index.php?route=product/search&filter_name=a&filter_category_id=20&filter_sub_category=true