Rich-text Reply

Redirect Experiments & Custom events

mkcarlos 05-09-16

Redirect Experiments & Custom events

Hi,

 

I've setup a redirect test that drive 50% visitors directly to a funnel process.

 

There are custom events configured on my Javascript Experiment based on an element $('.step_funnel') that takes a value on each step of the funnel, example:

 

$(function() {
if ($('.step_funnel').text()) == 'Step 1') {
window.optimizely.push(["trackEvent", "step1Success"]);

} else if ($('.step_funnel').text()) == 'Step 2') {
window.optimizely.push(["trackEvent", "step2Success"]);

}} else if ($('.step_funnel').text()) == 'Step 3') {
window.optimizely.push(["trackEvent", "step3Success"]);

 

});

 

The problem is that once the redirect is executed and the visitor lands to the funnel process, the experiments execution ends and consequently my JavaScript experiment does not fire anymore on the following steps (custom events dont fire).

How can I keep the test "alive"? So that once the user lands on the redirect page, the JavaScript experiment would be executed step by step as the user go on through the funnel.

 

Thanks in advance!

 

Level 2

JasonDahlin 05-09-16
 

Re: Redirect Experiments & Custom events

@mkcarlos -

There is a decent chance I am misinterpreting the request...

 

If I'm reading this right, you want to track events that are not in your experiment?  (Your experiment does nothing but redirect users into a funnel.  You want to track Step1 through Step 3 success using Optimizely events, but the funnel is not part of the experiment).

 

To do this, you need to either, add the funnel to the experiment so that you can include your custom JS, or you need to add your custom JS directly to those pages using some other methodof your choosing (perhaps a new experiment which does absolutely nothing except inject that code).

 

 

 

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
mkcarlos 05-09-16
 

Re: Redirect Experiments & Custom events

[ Edited ]

Thanks for your reply JasonDahlin,

 

That's it, I have to include all funnel steps as part of the experiments if I want to fire these custom events along the funnel.

 

The problem is that it's a Redirect Test, so if I add each step of the funnel in the URL Targetting, when the user reach the Step 2, Optimizely execute the experiment again (doing a redirect to the initial step, so users can't finish the process). 

 

 

How can I prevent the redirect code execution on the 2º and 3º step? (leaving users continue through the funnel)

Level 2
JasonDahlin 05-09-16
 

Re: Redirect Experiments & Custom events

@mkcarlos - If the funnel is loaded via AJAX, there is no new page load between steps 1 and 2 and between steps 2 and 3.  To listen to this you will something other than the text of the page.  I usually do a 2 step approach:

 

1- what you have - read the page - picks up the current step when the page loads (also handles if someone refreshes the page and sees Step 2/3 again, etc.)

2- listen for a trigger that DEV fires when the AJAX loads the next step into the DOM.

 

For #2, if you are a bit advanced in your coding, you could try building this yourself by listening for the AJAXComplete events and figuring out how to detect when the request is from "step 2" loading, or "step 3" loading.

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero

Re: Redirect Experiments & Custom events

So a bootstrapped solution that I've used for this is to just set up another experiment targeted to the redirect url where, in the variation code (with 100% traffic to sed variation), you place those tracking events.

So,

1. Experiment 1: 50% stays, 50% Redirections to Experiment 2.
2. Experiment 2: 100% to Control/Variation with the tracking events above.

That is NOT the most efficient way to use optimizely and it does require more work on the analytics side after; but if you need a quick fix - it works
Analyst