Analytics
4K members online now
4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

removing a 32 character hash from url

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there,

 

in our website the URL structure of the pages after user login is like this

 

https://example.com/930671c402ebcff7875a8fced597149a

 

the hash after / in URL is 32 characters wich is specific to each user and it consists of a to z characters in lowercase form and numbers

other pages parameters are coming after this address like this

 

https://example.com/930671c402ebcff7875a8fced597149a/Report/UsagePeriodicReport

https://example.com/8796d30630f04c59d9db886de42607d3/Voc/Problem

 

how can I remove this 32 characters with a word such as user-id ?

I do not know that I have to change tracking code or I can use filters to solve the problem.

 

thanks in advance

 

 

 

 

 

 

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Amir-abbas A
August 2016

Re: removing a 32 character hash from url

Top Contributor
# 3
Top Contributor

Alternatively, here is a screenshot of how your filter should look like.

Screenshot 2016-08-22 09.52.29.png

VP & Chief Evangelist at Hub'Scan | Contact me
Level 80 Digital Analytics Warrior, KPI Therapist and Keeper of the One True Tagging Plan

View solution in original post

Re: removing a 32 character hash from url

[ Edited ]
Top Contributor
# 2
Top Contributor

Hi there,

use a filter to remove the string from URLs.

Go to Admin > View > Filters and add a new filter

Select a custom filter, then choose advanced.

In field A, select Request URL and enter the following:

^/[a-z0-9]{32}(/.*)


In output field, select Request URL again and enter:

$A1


That will effectively replace your URL in Google Analytics with whatever is after the 32-character hash.

Make sure to test with a test view before applying to your work view(s).

VP & Chief Evangelist at Hub'Scan | Contact me
Level 80 Digital Analytics Warrior, KPI Therapist and Keeper of the One True Tagging Plan
Marked as Best Answer.
Solution
Accepted by topic author Amir-abbas A
August 2016

Re: removing a 32 character hash from url

Top Contributor
# 3
Top Contributor

Alternatively, here is a screenshot of how your filter should look like.

Screenshot 2016-08-22 09.52.29.png

VP & Chief Evangelist at Hub'Scan | Contact me
Level 80 Digital Analytics Warrior, KPI Therapist and Keeper of the One True Tagging Plan

removing a 32 character hash from url

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Hi again,

 

I'm using this filter for our websites. it works perfectly but there is a problem.

this setting will remove all of the hashes from the middle of URLs but it cannot remove hashes from URLs that end to the hash.

for example, we do not have such URLs anymore

 

https://example.com/8796d30630f04c59d9db886de42607d3/Voc/Problem

 

but we have plenty of URLs like this

 

https://example.com/229cb98a5bcc95a6c5c3365af6c24df0
 
when the URLs end to a hash and there isn't anything after that, this filter doesn't work. how can I fix this issue?
thanks a lot

 

 

Re: removing a 32 character hash from url

Top Contributor
# 5
Top Contributor

In that case, update the filter like so: (^/)[a-z0-9]{32}$

VP & Chief Evangelist at Hub'Scan | Contact me
Level 80 Digital Analytics Warrior, KPI Therapist and Keeper of the One True Tagging Plan

removing a 32 character hash from url

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

but I think this regex will remove all of the URLs that contains hashes.

 

I want to remove the hash from the URLs that end to hash and keep the main domain

I mean to change these:

https://example.com/8796d30630f04c59d9db886de42607d3

https://example.com/229cb98a5bcc95a6c5c3365af6c24df0

 

to: 

 

https://example.com/

 

and also remove hash from these URL:

 

https://example.com/930671c402ebcff7875a8fced597149a/Report/UsagePeriodicReport

https://example.com/8796d30630f04c59d9db886de42607d3/Voc/Problem

 

but I want to keep above URLs and change them to:

 

https://example.com/Report/UsagePeriodicReport

https://example.com/Voc/Problem

 

thanks

 

 

 

 

 

 

 

removing a 32 character hash from url

Top Contributor
# 7
Top Contributor

My latest version clears all URLs beginning with a slash (root) and then followed by the 32-char hash

 

A more inclusive approach (if you want what's after the hash) is to use the following:

 

^/[a-z0-9]{32}(.*)

 

VP & Chief Evangelist at Hub'Scan | Contact me
Level 80 Digital Analytics Warrior, KPI Therapist and Keeper of the One True Tagging Plan

removing a 32 character hash from url

[ Edited ]
Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

Hi @Julien Coquet

  I have a same query related to the one above but a bit different.

My URL looks like www.example.com/abc/cdf/xyz?sessionHash=103a23c16c37e3e5bbb9a8219ca460e3

Now I want to remove everything from '?'