Forum Moderators: DixonJones

Message Too Old, No Replies

Retain Analytics URL builder tracking thru 301 redirect

         

bill

6:20 am on Jun 2, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not sure if this would work in Google Analytics and wanted to run it by the WebmasterWorld crew.

I have a QR Code that's being printed on a calendar and distributed. We don't know the final URL for the campaign, and we are thinking of changing the target URL a couple of times. So I was thinking of http://example.com/2017-calendar/ for the QR Code.

Then I was considering using .htaccess to 301 redirect
Redirect permanent http://example.com/2017-calendar/ http://example.com/campaign-url/?utm_source=calendar&utm_medium=QR%20Code&utm_campaign=calendar%20qr
Would that 301 allow me to pass the URL Builder's campaign parameters to GA, or do I need to consider anything else? I don't care about referrer data because it would only be mobile devices scanning our printed material.

RhinoFish

2:46 pm on Jun 2, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you want to retain the original tags? Maybe try a QSA htaccess redirect. (I think QSA = query string append, that's how i remember it anyways)

If this is a server side redirect, meaning they didn't arrive untagged (aka un-UTM'd) and didn't ever run the GA traffic tracking script (marking them as NotSet), and you redirected to the target page with params appended and THEN they hit the GA traffic script for their first time upon arrival, yep, this will work.

lucy24

4:31 pm on Jun 2, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe try a QSA htaccess redirect. (I think QSA = query string append, that's how i remember it anyways)

Yup. In fact QSA is the default unless you're creating a new query string; that's when you need QSA if you also want to retain the old query. (If this is the case, make sure no parameters have the same names, or any code that processes them may get confused.) Does the original URL--the one you're redirecting--come with a query string of its own? Once you've got parameters involved, you shouldn't be using mod_alias for redirects anyway.

This is assuming Apache 2.2. Apache 2.4 has some additional flags, but none of the existing flags should be affected.

I don't care about referrer data

You don't need to care ;) The Rules say that the referer should be passed along intact in any redirect, so it hasn't gone anywhere anyway.