import { generateGAElements } from "./snippets/generateGAElements";
class GoogleAnalytics {
    initializeAsyncScript(src) {
        const script = document.createElement("script");
        script.async = true;
        script.src = src;
        return script;
    }
    initializeInlineScript(content) {
        const script = document.createElement("script");
        script.innerHTML = content;
        return script;
    }
    initialize(props) {
        const { measurementId } = props;
        const elements = generateGAElements({ measurementId });
        const asyncScript = this.initializeAsyncScript(elements.src);
        const inlineScript = this.initializeInlineScript(elements.script);
        document.head.appendChild(asyncScript);
        document.head.appendChild(inlineScript);
    }
}
export { GoogleAnalytics };
