JSFiddle - React, Tailwind, and code Playground

_gaq extension

by web-nfo.com

HTML

<a href="#test" onclick="_cwTrack.push(['_link', this.href]);return false;">Test</a>

JavaScript

console.clear();

var _debug = true;


var _cwTrack = _cwTrack || [];
_cwTrack.push(['_link', 'test1.html']);

_cwTrack.push({
    'type':'omniture2',
});





	// Wait for function to load, before executing (s, loadQubitScript, gaAllowIframeTracking, and gaCallPushEvent)
	function runWhenAvailable(functionName, object, callback, nextDelay)
	{
	    if(typeof nextDelay == 'undefined') {
	        var nextDelay = 100; // Start delay (ms)
	    } else {
	    	nextDelay = nextDelay + Math.round(nextDelay/3); // Incremental delay for next check
	    }
	    var functionAvailable = false;
	    
	    if (
          (functionName == 's' && typeof s != 'undefined') || /* omniture */
	      (functionName == 'loadQubitScript' && typeof loadQubitScript == 'function') ||
	      (functionName == 'gaAllowIframeTracking' && typeof gaAllowIframeTracking == 'function') ||
	      (functionName == 'gaCallPushEvent' && typeof gaCallPushEvent == 'function')  )
	    {
	    	// Execute the (callback) function
	    	callback.apply(object);
	        functionAvailable = true;
	    }
	    
	    if(!functionAvailable) {
	        setTimeout(function(){ //Try again in ... ms
	            if(typeof console != 'undefined') {
	                //console.log('function ' + functionName + ' not available, try again in ' + nextDelay + 'ms');
	            }
	            runWhenAvailable(functionName, object, callback, nextDelay);
	        }, nextDelay);
	    }
	}
	
	// Wait for iframe to load
	function runWhenIframeAvailable(iframeId, object, callback, nextDelay)
	{
	    if(typeof nextDelay == 'undefined') {
	        var nextDelay = 100; // Start delay (ms)
	    } else {
	    	nextDelay = nextDelay + Math.round(nextDelay/3); // Incremental delay for next check
	    }
	    var iframeAvailable = false;
	    
	    if(document.getElementById(iframeId))
	    {
	    	// Execute the (callback) function
	    	callback.apply(object);
	    	iframeAvailable = true;
	    }
	    
	    if(!iframeAvailable) {
	       ...