• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    Opera Mini: resuming paused script (for analytics)

    Opera Mini
    2
    4
    662
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Former User
      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.

      Reply Quote 0
        1 Reply Last reply
      • jackob11
        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.

        Reply Quote 0
          A Former User 1 Reply Last reply
        • A Former User
          A Former User @jackob11 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?

          Reply Quote 0
            1 Reply Last reply
          • A Former User
            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

            Reply Quote 0
              1 Reply Last reply
            • First post
              Last post

            Computer browsers

            • Opera for Windows
            • Opera for Mac
            • Opera for Linux
            • Opera beta version
            • Opera USB

            Mobile browsers

            • Opera for Android
            • Opera Mini
            • Opera Touch
            • Opera for basic phones

            • Add-ons
            • Opera account
            • Wallpapers
            • Opera Ads

            • Help & support
            • Opera blogs
            • Opera forums
            • Dev.Opera

            • Security
            • Privacy
            • Cookies Policy
            • EULA
            • Terms of Service

            • About Opera
            • Press info
            • Jobs
            • Investors
            • Become a partner
            • Contact us

            Follow Opera

            • Opera - Facebook
            • Opera - Twitter
            • Opera - YouTube
            • Opera - LinkedIn
            • Opera - Instagram

            © Opera Software 1995-