function () { // We'll need to add to this array all the accounts we want to check var gaAccounts = ['UA-XXXXXXX-Y']; // The var that is gonna hold the block switch that will returning by the macro var blockGTM = false; // Let's check for the presence of the legacy tracker object if (window._gat) { // Looping thru all the available objects to find their assigned UAs and match it against our defined UAs array for (var i = 0; i < _gat._getTrackers().length; i++) { for (var j = 0; j < gaAccounts.length; j++) if (gaAccounts[j] == _gat._getTrackers()[i]._getAccount()) blockGTM = true; } } // Let's check for the presence of the legacy tracker object if (window.ga) { // Looping thru all the available objects to find their assigned UAs and match it against our defined UAs array for (var i = 0; i < ga.getAll().length; i++) { for (var j = 0; j < gaAccounts.length; j++) if (gaAccounts[j] == ga.getAll()[i].get('trackingId')) blockGTM = true; } } return blockGTM; }