Opera Mini: resuming paused script (for analytics)
-
A Former User last edited by
So I've been reading Opera Mini and JavaScript and I'm trying to figure out how to resume paused scripts.
Essentially, I am trying to track a button using analytics (I'm using Yandex Metrica to do so).
window.onload = function () { onClick = function () { var button = document.getElementById('button'); setGoal = function () { ym(54060910, 'reachGoal', 'TEST'); return true; } setInterval(setGoal, 50); // Unpauses the interval restart = function () { // This can be an empty function } button.addEventListener('click', restart, false); } }
The tracking works fine in modern browsers, but not Opera Mini. I have modelled this function off the one in the above blog post, which is meant to resume paused scripts:
var box = document.getElementById('box'), update = document.getElementById('valofnewcol'), start = 0; changecolor = function(element, degreeshift, update) { var newcol = (start * degreeshift) / 360 << 8, col = 'hsl(' + newcol + ', 100%, 50%)', coltxt = document.createTextNode(col), anim, restart; element.style.background = col; start++; if (update.firstChild) { update.replaceChild(coltxt, update.firstChild); } else { update.appendChild(coltxt); } } anim = setInterval(changecolor, 50, box, 45, update); // Unpauses the interval restart = function(){ // This can be an empty function } box.addEventListener('click', restart, false);
My questions are:
- Is it possible to get tracking for analytics working in Opera Mini using this method?
- And if so, how do I amend my code to achieve that?
P.s I am using Yandex Metrica but I would assume the same principles would apply to Google Analytics.
P.p.s I've asked the same question on Stackoverflow if you'd like to answer there.
-
jackob11 last edited by
Sometimes & even on some website
javascript:skip works but not every website.
When the javascript is paused then all you need to do is to go to address bar of that following page type javascript:skip then enter. On some website it will resume the paused javascript.
I don't think there has any other way to resume it. -
A Former User last edited by
@jackob11 So no matter what, there's no way to force a script to run unless the user goes to an address bar and enters javascript:skip? It has to be done by the user, not a script?
-
A Former User last edited by
Hi,
does anyone else have any ideas?
What I'm simply trying to do is use Opera minis ability to resume paused scripts to be able to use analytics to track what our users are doing.
Has anyone else came across this problem before and could share some advice?
Thank you