UNPKG

redux-beacon-matomo-tag-manager

Version:
25 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var MatomoTagManager = function (_a) { var _b = (_a === void 0 ? {} : _a).dataLayerName, dataLayerName = _b === void 0 ? '_mtm' : _b; return function (events) { // tslint:disable-next-line:strict-type-predicates if (typeof window === 'undefined') { return; } if (!window[dataLayerName] || typeof window[dataLayerName].push !== 'function') { throw new Error("redux-beacon error: window." + dataLayerName + " is not defined. Have you forgotten to include Matomo Tag Manager and dataLayer?"); } events.forEach(function (event) { // tslint:disable-next-line:strict-type-predicates if (typeof event === 'object') { // tslint:disable-next-line:semicolon ; window[dataLayerName].push(event); } }); }; }; exports.default = MatomoTagManager; //# sourceMappingURL=matomo-tag-manager.js.map