JavaScript JavaScript listen for _gaq.push?

I've got a widget that injects javascript code into my users website. Now I would like to add the ability to listen for the Google Analytics _addTrans call.

Example of the call to Google Analytics:

<a onclick=" _gaq.push(['_addTrans',
    '1234',           // transaction ID - required
    'Acme Clothing',  // affiliation or store name
    '11.99',          // total - required
    '1.29',           // tax
    '5',              // shipping
    'San Jose',       // city
    'California',     // state or province
    'USA'             // country
  ]);" target='_blank' href="#">CONVERSION</a>

_gaq is an object supplied by Google Analytics.

Is it possible for my script to also receive the push event to the _gaq object?

I have tried:

if (window._gaq) {
    for (var i = 0; i < _gaq.length; i++) {     
        var method = _gaq[i].shift();
        console.log(method);
    }
};

window._gaq = {
    push: function() {
        try {
            var args = Array.prototype.slice.call(arguments, 0);
            console.log(args);
        }
        catch(err) { 
            console.log(err);
        }  
    }
};

It works but Google Analytics is now not able to track conversions anymore. It seems I am overriding it. Any ideas how this could be done?

Answer:1

The basic idea is to prevent double clicks. I'm using html <button> to call a function when clicked, which makes an ajax call. Native <button> behaviour is prevented with event....

The basic idea is to prevent double clicks. I'm using html <button> to call a function when clicked, which makes an ajax call. Native <button> behaviour is prevented with event....

  1. using underscore debounce

In my current project I discovered a problem using websockets with socket.io and node.js on mobile devices. It seems that there is a problem for mobile deviced handling socket messages in an interval. ...

In my current project I discovered a problem using websockets with socket.io and node.js on mobile devices. It seems that there is a problem for mobile deviced handling socket messages in an interval. ...

With the following code, when shift clicking the label, why isn't the checkbox's click handler fired in FF? Both Chrome and IE11 fires it. <script> function show(event) { alert((...

With the following code, when shift clicking the label, why isn't the checkbox's click handler fired in FF? Both Chrome and IE11 fires it. <script> function show(event) { alert((...

  1. checkbox in excel
  2. checkbox symbol
  3. checkbox in word
  4. checkbox in google docs
  5. checkbox emoji
  6. checkbox in google sheets
  7. checkbox icon
  8. checkbox css
  9. checkbox image
  10. checkbox text
  11. checkbox symbol in word
  12. checkbox in html
  13. checkbox checked
  14. checkbox unicode
  15. checkbox react
  16. checkbox value
  17. checkbox alt code
  18. checkbox bootstrap
  19. checkbox input
  20. checkbox onchange

So I'm trying to create a basic angular application that parses some CSV input, and fills a table with the parsed data. You can see a plunker of what I'm trying to achieve here - http://plnkr.co/...

So I'm trying to create a basic angular application that parses some CSV input, and fills a table with the parsed data. You can see a plunker of what I'm trying to achieve here - http://plnkr.co/...

  1. javascript parser angularjs
  2. defer parsing of javascript angularjs