@livingroot/yandex-metrica-ab-react
Version:
Fork of yandex-metrica-ab-react by firnis
32 lines (31 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSnippet = void 0;
const createSnippet = () => {
if ('ymab' in window) {
return;
}
(function (v, a, r, i, o, q, u, b) {
var _a;
v[o] = v[o] || function () { (v[o].a = v[o].a || []).push(arguments); };
q = a.createElement(r);
q.async = true;
q.src = i;
u = a.getElementsByTagName(r)[0];
(_a = u === null || u === void 0 ? void 0 : u.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(q, u),
q.addEventListener('error', function () {
var _a;
function fn(args) {
b = args[args.length - 1];
if (typeof b === 'function') {
b({ flags: {} });
}
}
(_a = v[o].a) === null || _a === void 0 ? void 0 : _a.forEach(fn);
v[o] = function () {
fn(arguments);
};
});
}(window, document, 'script', 'https://abt.s3.yandex.net/expjs/latest/exp.js', 'ymab'));
};
exports.createSnippet = createSnippet;