"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UmamiTrackingProvider = void 0;
class UmamiTrackingProvider {
    getKey() {
        return 'umamiKey';
    }
    initialize(props) {
        // eslint-disable-next-line no-console
        console.log('UmamiProvider initialize');
        const umamiKey = props.umamiKey;
        const hostUrl = props.umamiHostUrl;
        const script = document.createElement('script');
        script.src = hostUrl + '/script.js';
        script.async = true;
        script.defer = true;
        // Configure Umami properties
        script.setAttribute('data-website-id', umamiKey);
        script.setAttribute('data-domains', 'localhost'); // TODO ?
        script.setAttribute('data-auto-track', 'false');
        script.setAttribute('data-host-url', hostUrl); // TODO ?
        script.setAttribute('data-exclude-search', 'false'); // TODO ?
        document.body.appendChild(script);
    }
    identify(userID) {
        var _a;
        // eslint-disable-next-line no-console
        console.log('UmamiProvider userID: ' + userID);
        (_a = window.umami) === null || _a === void 0 ? void 0 : _a.identify({ userID });
    }
    trackPageView(url) {
        var _a;
        // eslint-disable-next-line no-console
        console.log('UmamiProvider url', url);
        (_a = window.umami) === null || _a === void 0 ? void 0 : _a.track({ url });
    }
    trackSingleItem(item, properties) {
        var _a;
        // eslint-disable-next-line no-console
        console.log('UmamiProvider: trackSingleItem' + item, properties);
        (_a = window.umami) === null || _a === void 0 ? void 0 : _a.track(item, properties);
    }
}
exports.UmamiTrackingProvider = UmamiTrackingProvider;
