Analytics
1.9K members online now
Understand information in your reports and troubleshoot reporting issues such as self-referrals, (not set) data, and inaccurate information
 
Guide Me
star_border
Reply

Event tracking - removing specific query strings parameters from URLs

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

I'm a titch embarrassed to ask this, cause I know it's a relatively simple fix...but when I search I keep running across discussions on stripping URL query parameters which isn't what I am seeking...

 

When I view my Custom Report labeled "PDFs Downloads by Filename" I see strings such as:

 

http://www.mydomain.com/wp-content/uploads/filename_011416.pdf

 

listed in the table. Now I am reporting this under the Dimension as "Event Label" via GTM...so, how can strip out:

 

http://www.mydomain.com/wp-content/uploads/

 

Thanks, T 8)

1 Expert replyverified_user

Re: Event tracking - removing specific query strings parameters from URLs

Rising Star
# 2
Rising Star
Hi T8,

So you could use an advanced filter in GA but I prefer to clean my data in GTM prior to passing to GA whenever possible.

In this case it depends on how you are collecting this to pass to GTM as there are many roads that lead to where you want to go.. My guess is you're just passing the href of what was clicked or something similar. I think the best way would to instead collect and modify this datapoint in a custom JavaScript variable.

Simo Ahava has a walkthrough of the code needed here:

http://www.simoahava.com/analytics/macro-magic-google-tag-manager/#4

He mentions macros but that's because it's what they used to be called and can still be used.


Best,

Theo Bennett



Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn