Config Goal Helpers - Delegate; Custom Triggers; DomReady vs WindowLoad

Status: Maybe One Day
by tomfuertes ‎02-26-2015 February 26, 2015

We end up doing an unecessary amount of custom events to get around timing of elements being in the dom and/or needing to track something other than clicks and pageviews. Building out the goals config further to something more generic that could config selector, action, bind time (domReady or window.load), and/or the option to delegate the selector so that you don't have to waitForElement poll to bind the handlers would be great.

 

// configurable in goals modal
var selector = $('#config-selector').val(); // '#form' var action = $('#config-action').val(); // 'submit' var ready = $('#config-ready').val(); // true
// psuedocode for binding
$(ready ? document : window)[ready ? 'ready' : 'load'](function () { $(selector)[action](function () { window.optimizely.push(['trackEvent', '{slug}']); }); }) // var delegateTo = $('#config-delegate'); // optional (string) // would be a bit more difficult than coding in the optiverse // code editor before coffee lends itself... I have faith though!

 

Status: Maybe One Day
Level 2

Comments
by Optimizely
‎06-01-2015 June 1, 2015
Status changed to: Maybe One Day
 
Optimizely