Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Last active November 29, 2017 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveosoule/98d7c9b4bf60be57b9dd352fd0ff8d6c to your computer and use it in GitHub Desktop.
Save steveosoule/98d7c9b4bf60be57b9dd352fd0ff8d6c to your computer and use it in GitHub Desktop.
Ad-Blocked MVGA.js Overrides for when GA is not loaded
/**
If Google Analytics does not load (add-blocking, network issues, etc.),
Then we need to disable the MVGA tracking functions and let the forms/links submit normally.
*/
$(window).on('load', function add_ga_failsafes(){
if( typeof ga !== 'undefined' && typeof ga.create !== 'undefined' ){
return;
}
MVGA_Tracker.prototype.List_AddToBasketSubmit = function(e){};
MVGA_Tracker.prototype.RemoveFromBasketForms = function(e){};
MVGA_Tracker.prototype.UpdateBasketQuantity = function(e){};
MVGA_Tracker.prototype.UpsellOUS1FormSubmit = function(e){};
MVGA_Tracker.prototype.UpsellFormSubmit = function(e){};
MVGA_Tracker.prototype.OSELFormSubmit = function(e){};
MVGA_Tracker.prototype.AddToBasketSubmit = function(e){};
MVGA_Tracker.prototype.ProductLinkClick = function(e){};
MVGA_Tracker.prototype.RemoveFromBasketLinks = function(e){};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment