Rich-text Reply

Change querry parameters on redirected variation url

frederic 12-03-16

Change querry parameters on redirected variation url

[ Edited ]

Hi all!

 

When we create a redirect-experiment, can change the querry parameters we have from the original page?

For example:


I have a url that is:

 

https://www.blablacar.com.br/lp/ORIGINAL?from=cityA&to=cityB&utm_campaign=BR_BO_ORIGINAL&utm_medium=banner

 

I want to redirect this visitor to:

 

https://www.blablacar.com.br/lp/VARIATION?from=cityA&to=cityB&utm_campaign=BR_BO_VARIATION&utm_medium=banner

 

So that in Tableau, we could track 2 different utm_campaings 

 

The problem is that I cannot create a redirect experiment that has original and variation as "simple match" of the urls above because city A and city B changes according to the origin and destination the visitor chose on the previous site (the site is a bus company, so instead of city A and city B could be city C and city D, and I cannot create a variation for each of them because there are more than 1 million combinations). I assume I have to create a redirect experiment keeping "Redirect with live query parameters included" checked, but I do not know how can I change this passed querry parameters after. 

Does anyone know how could I do that?

 

 

PS: I could create an editted variation if it is the only way to do that, but I would still need to change the utm_campaign (actually it is the only querry parameter I need to change)

 

Thanks very much!
João

Level 2

RyanC 12-05-16
 

Re: Change querry parameters on redirected variation url

What you would need is to use Regular Expression match.

And then create custom code in the code editor, to read the current url and build a redirect url according to the city.

Ryan
------------------------------------------------
The best solution is the simplest.

https://www.linkedin.com/in/ryan-camilleri
http://midnightknights.com
Experimentation Hero

Re: Change querry parameters on redirected variation url

Hi João,

 

Is the main goal of this whole thing to basically assure proper tracking in whichever internal tool you're using? Because if that's the case I think you're better off with another approach. I can imagine this working out, but would be quite hacky and unreliable (IMO).

 

What we do is pushing window.optimizely.data.state.variationMap (which basically carries experiment ID and variation numbre - 0 for original, 1 for variation) to the dataLayer as a variable. Then push that {{variable}} to our tracking tool which creates a Tableau split report for both audiences (both A and B) where we can track not only the usual clicks and page reach metrics, but CLV and anything else you can imagine.

 

Hope this makes sense, if not feel free to reach out Smiley Happy

 

best,

Ivo

Performance Marketing Manager @ Blacklane
Founder @ Stereofox

frederic 12-05-16
 

Re: Change querry parameters on redirected variation url

[ Edited ]

Hi Ryan!

 


So you say that in "URL Targeting" I have to put "Regular Expression" and then changes the code inside the editor? Do you know how the code would look like (it does not need to be the right code itself, but only for me to know where I have to change).

Thank you very much!

João

Level 2
frederic 12-05-16
 

Re: Change querry parameters on redirected variation url

Hi Ivo!

Any solution for me that's working is fine =)
I really just want this running hahaha

Actually I did not understand very well (sorry!). What would be the alterations I will have to do in Optimizely, and what would be the alterations in Tableau Report (if any). Here in Brazil office we only use a Tableau Report that our collegues from Paris make for us (we do not create or edit things in Tableau, only read). That is no problem in asking them to make a different Tableau report, but I need to tell them exactly what to change as I'm not a Tableau expert by myself. Could you help me with that?

Thank you very much!
João
Level 2

Re: Change querry parameters on redirected variation url

Hey João,

 

Sure! As this might take a lot of back and forth, feel free to write me a private message and we can have a quick chat about it.

 

best,

Ivo

 
Performance Marketing Manager @ Blacklane
Founder @ Stereofox

RyanC 12-05-16
 

Re: Change querry parameters on redirected variation url

How Regular Expression match works: https://help.optimizely.com/Target_Your_Visitors/URL_Targeting%3A_Choose_where_your_experiment_runs#...

Then for your custom code you will have something like this:

function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}

var city1 = getUrlVars()["from"];
var city2 = getUrlVars()["to"];

window.location.replace("https://www.blablacar.com.br/lp/VARIATION?from=" +city1 +"&to=" +city2 +"&utm_campaign=BR_BO_VARIATION&utm_medium=banner");
Ryan
------------------------------------------------
The best solution is the simplest.

https://www.linkedin.com/in/ryan-camilleri
http://midnightknights.com
Experimentation Hero