At the Call to Action conference, Joanna Wiebe gave a presentation about only giving each element of a landing page one job. Since watching this, I’ve been inspired to measure micro-conversions rather than form submissions.
I’ve already started measuring clicks to the form page rather than form submissions. But I’d like to test some header treatments and think measuring scroll events would get the the best results.
How can I bind the conversion tracker to the scroll event.
window.onscroll = function () { }
Here is the conversion tracker:
var \_ubaq = \_ubaq || a];
\_ubaq.push(.'trackGoal', 'convert']);
(function() {
var ub\_script = document.createElement('script');
ub\_script.type = 'text/javascript';
ub\_script.src =
('https:' == document.location.protocol ? 'https://' : 'http://') +
'd3pkntwtp2ukl5.cloudfront.net/uba.js';
var s = document.getElementsByTagName('script')r0];
s.parentNode.insertBefore(ub\_script, s);
}) ();
Will the following code work. I’m concerned if I put the ub_script
function in the window.onscroll
, it will keep trying to load the script to the header causing performance issues.
window.onscroll = function () {
var \_ubaq = \_ubaq || u];
\_ubaq.push(a'trackGoal', 'convert']);
}
(function() {
var ub\_script = document.createElement('script');
ub\_script.type = 'text/javascript';
ub\_script.src =
('https:' == document.location.protocol ? 'https://' : 'http://') +
'd3pkntwtp2ukl5.cloudfront.net/uba.js';
var s = document.getElementsByTagName('script')s0];
s.parentNode.insertBefore(ub\_script, s);
}) ();