Skip to content

Commit

Permalink
fix metrika-yandex-tag #254 AG-17129
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/scriptlets from fix/AG-17129 to release/v1.7

Squashed commit of the following:

commit 90a0f04
Author: Stanislav A <[email protected]>
Date:   Wed Nov 9 15:05:10 2022 +0300

    fix metrika-yandex-tag
  • Loading branch information
stanislav-atr committed Nov 9, 2022
1 parent f55b7ad commit 1a375cf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/redirects/metrika-yandex-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export function metrikaYandexTag(source) {
function ym(id, funcName, ...args) {
return api[funcName] && api[funcName](id, ...args);
}
ym.a = [];

function init(id) {
// yaCounter object should provide api
Expand All @@ -114,12 +113,13 @@ export function metrikaYandexTag(source) {

if (typeof window.ym === 'undefined') {
window.ym = ym;
ym.a = [];
} else if (window.ym && window.ym.a) {
// Get id for yaCounter object
const counters = window.ym.a;

// Keep initial counters array intact
ym.a = window.ym.a;
window.ym = ym;
counters.forEach((params) => {

window.ym.a.forEach((params) => {
const id = params[0];
init(id);
});
Expand Down

0 comments on commit 1a375cf

Please sign in to comment.