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

Redirecting url with utm parameters

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi everyone,

 

If I have the url "sitea.com/test" that redirects to "siteb.com", when I click on "sitea.com/test?utm_source=blog", "sitea" gives the message "page not found" and doesn't redirect to "siteb". Is there a way to make this work?

 

Thanks!

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Rodrigo S
June

Redirecting url with utm parameters

Top Contributor
# 4
Top Contributor

Great to hear the change now sees it working for you :-))

 

Also, when should I use "?" and "#"?

 

Usually you should use ?. That would be my first choice. Not all sites recognize it though, and getting a site configured to recognize it is beyond the scope of this help forum.
Google analytics does not usually track anything after a # in a url by default eg anchor links
BUT

it does recognize appended utm parameters after a ? or # by default

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

View solution in original post

Redirecting url with utm parameters

Top Contributor
# 2
Top Contributor

Hi @Rodrigo S

 

Does changing the url by appending the parameter with a # instead of a ? work

eg sitea.com/test#utm_source=blog

Also how is the redirect being done?

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

Redirecting url with utm parameters

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you very much! It worked!

 

Actually, I'm trying to track a link inside my ebook that sends the reader to a 3rd party sales page. So, to track it with GA, I first had to redirect the the link to my blog, then to the sales page. The redirection is set on my host provider (Hostinger).

 

Since I can't track the link to a 3rd party site, I first redirected the link in the ebook to my blog where I can track it, then to the final destination sales page. It goes like this.

 

Link on ebook "sitea.com/teste#utm_source=blog" goes to "sitea.com/test" that redirects to "siteb.com" (I put "source=blog" because the ebook is downloaded from the blog).

 

Does it make any sense what I'm doing? Is there a better way to track clicks on a ebook to 3rd party sites? Also, when should I use "?" and "#"?

 

Thank you one more time!

Marked as Best Answer.
Solution
Accepted by topic author Rodrigo S
June

Redirecting url with utm parameters

Top Contributor
# 4
Top Contributor

Great to hear the change now sees it working for you :-))

 

Also, when should I use "?" and "#"?

 

Usually you should use ?. That would be my first choice. Not all sites recognize it though, and getting a site configured to recognize it is beyond the scope of this help forum.
Google analytics does not usually track anything after a # in a url by default eg anchor links
BUT

it does recognize appended utm parameters after a ? or # by default

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

Redirecting url with utm parameters

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hello Bronwyn and other experts!

 

I'm facing another redirect related issue with UTM parameters and hoping that you could help or at least give some clarity on whether this should work or not.

 

We have a website build on WordPress. It's using a Quick Redirect plugin to create nicer URLs within the site. For example https://mysite.com/app could be a redirect for https://mysite.com/products/my-very-nice-application.

 

Then I'm using UTM parameters to track traffic and would like to use those together with redirected URLs. But that doesn't seem to work.

 

If I create this URL with UTM parameters, it doesn't show those parameters in Analytics:
https://mysite.com/app?utm_source=test&utm_medium=test&utm_campaign=test

 

But if I use this URL instead, then all parameters are showing up just nicely:

https://mysite.com/products/my-very-nice-application?utm_source=test&utm_medium=test&utm_campaign=te...

 

So... something to do with WordPress or the Quick Redirect plugin, or simply not supported by UTM parameters and Analytics?

 

Cheers,

--Mikko

Re: Redirecting url with utm parameters

Top Contributor
# 6
Top Contributor

Hi @Mikko J :-)

Often redirects will strip parameters from urls. 

 

 https://mysite.com/app?utm_source=test&utm_medium=test&utm_campaign=test

Is being redirected

however 

https://mysite.com/products/my-very-nice-application?utm_source=test&utm_medium=test&utm_campaign=te...

is the end url without any redirection applied.

 

If you have access to the site's htaccess file, it may make more sense to simply pop the redirects in there directly

Thread on SO with some useful replies about this

https://webmasters.stackexchange.com/questions/67031/301-redirection-removes-utm-tags-from-urls

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

Redirecting url with utm parameters

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Thanks @Bronwyn V, that seems to be the case.