-1

I might worrying way too much here, but here it goes...

I have set up google analytic campaign tracking URLs using the google campaign link builder.

These URLs are really ugly and I'm not a fan of the visitor seeing this long tracking url on there first visit to my site.

for example : https://demosite.com/?utm_source=company_name&utm_medium=banners&utm_campaign=&utm_term=publisherid

I would like to instantly redirect above url to my main website main url http://demosite.com/

Using javascript or php in my header.php or functions.php

Is there some how this can be written so that all utm params info also received by GA and once tracking (utm) url loaded then it instantly redirect to main url.

Any suggestions would be great thanks!

  • I think this should not actually redirect anywhere in the first place, but just manipulate the URL on the client side using the History API. But you will probably still have to figure out the right moment to do that, because the Google script likely reads those values from the current URL, so you must not do it before it is done with that. – 04FS Feb 12 '19 at 10:19
  • Yes agree but after once it load it completely, can it redirect again to my website main url by any possible way. – Amit Rathore Feb 12 '19 at 10:51
  • No, don’t do an actual redirect - that would mean a second request, so a) users will have to wait longer, and b) the rest of your tracking/analytics might get messed up, if those seconds requests got counted as well. Purely client-side “cosmetical” issue, so it should be handled client-side as well (without bothering the server again.) – 04FS Feb 12 '19 at 11:14

1 Answers1

0

Here are some methods to redirect after google analytics records the page view: Javascript Redirect with Google Analytics

There's no guarantee as to how long it will take for the google analytics script to initialize, so there could be some visible delay in certain cases before your redirect happens.

jspcal
  • 50,847
  • 7
  • 72
  • 76