"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = require("../common");
function GoogleAnalytics(_a) {
    var trackingId = _a.trackingId, _b = _a.force, force = _b === void 0 ? false : _b;
    if (common_1.constants.IS_DEV && !force) {
        return common_1.React.createElement("script", null);
    }
    else {
        return (common_1.React.createElement(common_1.React.Fragment, null,
            common_1.React.createElement("script", { async: true, src: "https://www.googletagmanager.com/gtag/js?id=" + trackingId }),
            common_1.React.createElement("script", { dangerouslySetInnerHTML: { __html: formatScript(trackingId) } })));
    }
}
exports.GoogleAnalytics = GoogleAnalytics;
var formatScript = function (trackingId) {
    return "\n    window.dataLayer = window.dataLayer || [];\n    function gtag(){dataLayer.push(arguments);}\n    gtag('js', new Date());\n    gtag('config', '" + trackingId + "');\n  ";
};
//# sourceMappingURL=GoogleAnalytics.js.map