AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.5K members online now
4.5K 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

Event tracking - removing specific query strings parameters from URLs

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

What would be the possible ways of removing specific query string URL parameters from the page info generated by an Event Tracking call?

 

We are using the ga.js library for Event tracking.

As opposed to the _trackPageview() method which has a "pageURL" parameter where we can alter the page URL/query string, the_trackEvent event method does not seem to have such URL option (parameters are: category, action, opt_label, opt_value, opt_noninteraction).

 

We do not want to use filters "Exclude URL Query Parameter" from the "Admin" console > "View settings" since this solution is view specific and does not prevent sending/storing those query parameters values on the servers.

 

Thanks for your help

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Matthieu P
January 2016

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

Top Contributor
# 2
Top Contributor

Hi Matthieu P,

(I presume you mean that you are using ga.js for everything, and not just event tracking.) You'd have to rewrite the page parameter to exclude those QPs that you don't want. A bit of Javascript should do the trick. When you sent your event hit, you would need to modify the page as well:

 

_gaq.push(['set', 'page', '/some/page'], ['_trackEvent', 'myCategory', 'myAction']);

You can do both actions within one _gaq call as above, where "/some/page" will contain your modified URL.

 

Hope this helps.

Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Matthieu P
January 2016

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

Top Contributor
# 2
Top Contributor

Hi Matthieu P,

(I presume you mean that you are using ga.js for everything, and not just event tracking.) You'd have to rewrite the page parameter to exclude those QPs that you don't want. A bit of Javascript should do the trick. When you sent your event hit, you would need to modify the page as well:

 

_gaq.push(['set', 'page', '/some/page'], ['_trackEvent', 'myCategory', 'myAction']);

You can do both actions within one _gaq call as above, where "/some/page" will contain your modified URL.

 

Hope this helps.

Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn