1.8K members online now
1.8K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply
Highlighted

Excluding pagination appends from Search Terms

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

 

 

The website I'm working on uses a folder structure in the URL for the site search e.g. /search/keyword/, so I've created a filter to handle this in order to acquire the search term data into GA as intended.

 

However, these result pages can be paginated depending on the amount of results, and the pagination append in the URL is being included as part of the Search Term which is skewing the data and creating lots of duplicates (see below).

I do have the 'Strip query parameters out of URL' ticked in the View Settings, however I believe the filter overrides this.

Please advise on how I can get all the below instances to be consolidated to just 'north-london' (for example).

 

Search Term OutputsSearch Term OutputsThe Search FilterThe Search Filter

 

1 Expert replyverified_user

Excluding pagination appends from Search Terms

Top Contributor
# 2
Top Contributor

You could create a second filter looking for   /search/(.*)?page=(.*)   and use $A1

place that filter BEFORE the other one to deal with URLs containing the page= sequence.

Mike Sullivan, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Re: Excluding pagination appends from Search Terms

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Mike,

 

Thanks for the suggestion. I've implemented this as you've suggested, but I'm still getting the same search terms i.e. paginated and non-paginated.

 

Screen Shot 2017-10-29 at 20.41.29.png

 

I've made sure that this new filter (below) is BEFORE my other one.

 

Any ideas what I'm doing wrong please?

 

Just want my ?page= search terms to be consolidated/added to the non paginated search terms.

 

Screen Shot 2017-10-29 at 20.54.57.png

Excluding pagination appends from Search Terms

Top Contributor
# 4
Top Contributor

Well, first an apology...I glossed over the filter definition on the fly and didn't get it right.

 

Here's what you should do:

 

Field A:  Request URI   > /search/(.*)?page=(.*)

OutputTo: Request URI  > /search/$A$1

Check both Field A Required and Override Output Field

 

Your filter was writing the results into the Search Term field, so the actual page was captured (from the Request URI) the same as before.

 

 

Mike Sullivan, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Excluding pagination appends from Search Terms

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi Mike,

 

Sorry for my delayed response! I've tried your revised solution above but unfortunately it still doesn't have the desired effect. I noticed that the paginated search terms (as they appear) were no longer showing, which initially I thought meant that they were being consolidated correctly with the non-paginated versions. But I then started seeing the top search term as (not set), which a large volume of traffic compared to the rest. So it seems all the paginated versions were grouped under (not set).

Do you have any other suggestions on this one? I checked it over many times, and tried also tweaking and re-ordering but to no avail.

Excluding pagination appends from Search Terms

Top Contributor
# 6
Top Contributor

oh....jeez, sorry. I work in Excel too much..  it should have been 

/search/$A1        not /search/$A$1

 

 

Alternative: in the View Settings, you can add 'page' to the list for

Exclude URL Query Parameters

Mike Sullivan, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Re: Excluding pagination appends from Search Terms

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hi Mike,

 

It's so close! It seems the ? in the pagination query isn't being consolidated, so unfortunately search terms with or without pagination appended are still being treated as separate search terms:

Screen Shot 2017-12-07 at 23.50.02.png

Sorry to be a pain, do you have any suggestions please? I initially thought removing the ? from the first field below, but on second thought I expect that won't match it to the 2nd (.*) which won't have a ? appended.

Screen Shot 2017-12-07 at 23.53.41.png

Excluding pagination appends from Search Terms

Top Contributor
# 8
Top Contributor

Sorry...forgot the question mark is a special character in regex. It needs to be 'escaped' with a leading \.

 

/search/(.*)\?page=(.*)

 

 

Mike Sullivan, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.