// <noscript><p><img src="https://merida.morpheu5.net/balmyogre?idsite=1&amp;rec=1" style="border:0;" alt="" /></p></noscript>

import type { ConsentStore } from "~/types";

export default defineNuxtPlugin(_nuxtApp => {
    const consentStore = useCookie('consent-store').value as ConsentStore;
    const analytics = consentStore?.analytics;

    if (analytics || true) {
        const u = "https://merida.morpheu5.net/";
        const _paq = window._paq = window._paq || [];
        _paq.push(['setRequestMethod', 'POST']);
        _paq.push(['requireCookieConsent']);
        _paq.push(['trackPageView']);
        _paq.push(['enableLinkTracking']);
        _paq.push(['setTrackerUrl', `${u}balmyogre`]);
        _paq.push(['setSiteId', process.dev ? '3' : '1']);
        
        useHead({
            script: [
                {
                    src: `${u}prettyprincess`,
                    // body: true,
                    async: true,
                }
            ]
        });
    }
});