Optimizely Analytics Extension that allows you to measure the "Time To Conversion" for a given metric within your experiment
This works by persisting a list of timeable events & bucketing timestamps in localStorage. Within Project JavaScript, there is an event tracking listener (docs) that checks to see if the fired event lives in the list of timeable events. If so, the elapsed time (in seconds) between the
Start Timer At Event (api name)
timestamp and the current time is calculated and this value is dispatched as an event (numeric metric) to Optimizely.
Update: Previously, the module used the Optimizely visitor attributes API to store the data. This resulted in sending large chunks of stringified JSON in every Optimizely event request. The timestamp data has since been moved to separate local storage keys. Caveat: Measuring time-to-conversion across domains will not work out of the box, since the timestamp data is no longer attached to the Optimizely visitor data storage.
- Install the
Project JavaScript
code found in projectjs.min.js - Create an Analytics Extension from JSON (Optimizely docs)
- Copy the JSON contents from analytics-integration-config.json
- Enable the extension you created (Optimizely docs)
- Create a Numeric Metric (Optimizely docs) and take note of its api name
- Navigate to the experiment to which you'd like to track the conversion
- Visit the 'Metrics' tab and add the Numeric Metric you created in the first step
- Visit the 'Integrations' tab and you will see a Time To Conversion integration module
- Check the 'tracked' checkbox in the upper right
Start Timer At Event (api name)
- api name of the event you want to begin the timer (required)Stop Timer At Event (api name)
- api name of the event you want to stop the timer (required)Elapsed Time Metric (api name)
- api name of the numeric event you will track the elapsed time to (required)Max Time To Conversion
- will ignore elapsed times above the supplied valueMin Time To Conversion
- will ignore elapsed times below the supplied valueResettable
- indicates you want to reset the timer if the user re-converts onStart Timer At Event
Resettable After Elapsed Time (sec)
- will only reset the timer if a user re-converts onStart Timer At Event
after the supplied number of seconds
- Save your changes, Publish the experiment
window.optimizely.get("custom/ttc").debug();
localStorage.setItem('logttc', 1);
- Timeable events that are registered into the visitors profile (via the
window.optimizely.get("custom/ttc").bindTTCTracking
call within the extension - Dispatched tracking calls to Optimizely that include the numeric metric 'time to conversion'
- Multiple metric support (currently you can only configure to time a single metric)
- Conversions in the same session only (extension setting)