eZ Community » Forums » Developer » Google Analytics - campaign urls -...
expandshrink

Google Analytics - campaign urls - pass query strings in custom URL aliases?

Google Analytics - campaign urls - pass query strings in custom URL aliases?

Wednesday 11 April 2012 4:03:39 am - 6 replies

I'm wanting to allow query strings to pass through when redirecting to a custom URL alias - any ideas where the best place to start digging is?

e.g mysite.com/special?utm_source=google&utm_medium=email&utm_content=easter&utm_campaign=myproduct  =>  mysite.com/uk/category/products/special?utm_source=google&utm_medium=email&utm_content=easter&utm_campaign=myproduct

Wednesday 11 April 2012 8:34:25 am

Hi Geoff,

I think its a deprecated method but maybe you could start working on this:

http://projects.ez.no/redirect_operators

i also could imagine, that you could work something out on vhosts in your apache via regex.

Best Chris

Thursday 12 April 2012 3:28:59 am

Hi Christoph,

Thanks for sharing the redirect operator extension - looks useful, but doesn't fulfill my need.

Apache rewrites are a last resort - I want to allow content managers to set up such aliases with query strings.

Many thanks,

Geoff

Thursday 12 April 2012 10:37:05 am

Hey Geoff,

to be honest, this was my concern. But at least I don't see another way than the apache vhost rewrite solution. But you can make it happen! blunk.gif Emoticon

Best
Chris

Friday 13 April 2012 11:56:44 am

So, after a quick test and check with Eclipse + XDebug, I overrode the default eZHTTPTool class in my extension and added a line to the end of the eZHTTPTool::createRedirectUrl method:

if ( isset($_SERVER[QUERY_STRING]) && $_SERVER[QUERY_STRING] != '' )
$uri .= '?' . $_SERVER[QUERY_STRING];

Hopefully this won't stuff anything up in the process.  I'll probably add a setting for turning this off/on in site.ini > HTTPHeaderSettings and add it to the above condition.

Cheers,

Geoff

Modified on Friday 13 April 2012 12:00:16 pm by Geoff Bentley

Sunday 15 April 2012 9:12:31 pm

@Geoff looks interesting enough for a pull request...

Monday 16 April 2012 3:39:14 am

Quote from Gaetano Giunta :

@Geoff looks interesting enough for a pull request...

I'll get onto it then! happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu