Binding External Conversion Tracking to Scroll Event

  • 11 February 2015
  • 2 replies
  • 4 views

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 || [];   
\_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')[0];   
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 || [];   
\_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')[0];   
s.parentNode.insertBefore(ub\_script, s);   
}) ();   

2 replies

Userlevel 2

Hi Phillip,

Unfortunately the external tracking script is only designed to be placed on a page and then run when that page is loaded. There’s no way that I can think of to get the script to send the conversion later, when an event is fired, that I can think of. I tested a few things and couldn’t get the anything to work along those lines.

You definitely have an interesting use case though Ð I’ll pass that along to our product team to take into consideration for future improvements to the external conversion tracking script.

Hello Mark - have there been any progress on this issue?

I would like to do the same, trying to send conversion for Olark chat (in this case for offline message submittion), but cannot get it to work.

In the unbounce helper (chrome extension) I get confirmed “External script detected”, “Unbounce cookies detected” but it is failed to send the event itself.

Have you updated the external tracking script to work on the same page? Any workaround? Thank you.

Reply