Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter mypixels

    (@mypixels)

    I have a working solution for my case.

    This needs to be inserted in wp-config.php
    define(‘WP_SITEURL’, ‘https://’ . $_SERVER[‘HTTP_HOST’]);
    define(‘WP_HOME’, ‘https://’ . $_SERVER[‘HTTP_HOST’]);

    The domain with the translation then “holds” the correct URLs and the languages ??are not mixed together with the primary domain and language.

    *If used as above, the language switcher stops working (all URLs go to the currently selected language mutation) – I’m not currently dealing with it because I end up using it statically and not generated via Polylang.

    Thank you! That fixed the issue. Missing iframes and stuff are somewhat pain in the… but I think I can live with it ??

    I have the same problem.
    I tried to clear the settings, turn off all plugins, etc. Nothing helped.

    Thread Starter mypixels

    (@mypixels)

    Thanks for the info. The stickers are nice, but I take it that if the plugin is “free” (it costs a lot of your time), I will at least support a little of my own work and I will not generate additional costs for you ??

    Thread Starter mypixels

    (@mypixels)

    I don’t currently have enough traffic to experiment on this. For now, it seems like a working solution, but I can’t say for sure.

    In the example above, there is an error regarding disabled parameter passing.

    I am currently looking for someone more experienced who will help me validate the solution ??

    <script>
        // Define dataLayer and the gtag function.
        // https://developers.google.com/tag-platform/devguides/consent
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('consent', 'default', {
            'ad_storage': 'denied',
            'analytics_storage': 'denied',
            'wait_for_update': 500,
        });
        gtag('set', 'url_passthrough', true);
        gtag('set', 'ads_data_redaction', false);
    
        // Check if cookie exists
        // modified https://www.w3schools.com/js/js_cookies.asp
        function checkCookie(cname) {
            let username = getCookie(cname);
            if (username != "") {
                return true;
            } else {
                return false;
            }
        }
    
        // Get cookie
        // umodified https://www.w3schools.com/js/js_cookies.asp
        function getCookie(cname) {
            let name = cname + "=";
            let decodedCookie = decodeURIComponent(document.cookie);
            let ca = decodedCookie.split(';');
            for(let i = 0; i <ca.length; i++) {
                let c = ca[i];
                while (c.charAt(0) == ' ') {
                    c = c.substring(1);
                }
                if (c.indexOf(name) == 0) {
                    return c.substring(name.length, c.length);
                }
            }
            return "";
        }
    
        // Check if cookie from plugin "Cookies and Content Security Policy" exists
        if (checkCookie('cookies_and_content_security_policy') == true) {
            consent_cookie = getCookie('cookies_and_content_security_policy');
    
            if (consent_cookie.includes("statistics")) {
                // Google Analytics allowed
                gtag('set', 'ads_data_redaction', false);
                gtag('consent', 'update', {
                    'ad_storage': 'granted',
                    'analytics_storage': 'granted',
                    // 'functionality_storage': 'granted',
                    // 'personalization_storage': 'granted',
                    // 'security_storage': 'granted',
                });
            } else {
                // Google Analytics disallowed
                gtag('set', 'ads_data_redaction', true);
                gtag('consent', 'default', {
                    'ad_storage': 'denied',
                    'analytics_storage': 'denied',
                });
            }
        } else {
            // Cookie from plugin "Cookies and Content Security Policy" doesn't exists
        }
    </script>

    This often happens when a smooth scrolling or similar script is fired at # anchors.
    At least in my case it was like this.

    Thread Starter mypixels

    (@mypixels)

    So far, I have only prepared a rough prototype for testing purposes.

    I would appreciate feedback from someone with technical experience with Google Analytics. My specialization lies elsewhere than GA / GTM and JS. I’m not sure if I understood everything correctly, but it seems that the parameters are not passed ?? From what I see Google Tag Assistant does not report problems and cookies are not stored until you agree with that.

    The prerequisite for functionality is the correctly set consent settings in GTM https://support.google.com/analytics/answer/9976101 and the addition of GTM / Analytics among the always allowed scripts.

    
    <script>
        // Define dataLayer and the gtag function.
        // https://developers.google.com/tag-platform/devguides/consent
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('set', 'url_passthrough', true);
        gtag('set', 'ads_data_redaction', true);
        gtag('consent', 'default', {
            'ad_storage': 'denied',
            'analytics_storage': 'denied',
            'wait_for_update': 500,
        });
        // Check if cookie exists
        // modified https://www.w3schools.com/js/js_cookies.asp
        function checkCookie(cname) {
            let username = getCookie(cname);
            if (username != "") {
                return true;
            } else {
                return false;
            }
        }
        // Get cookie
        // umodified https://www.w3schools.com/js/js_cookies.asp
        function getCookie(cname) {
            let name = cname + "=";
            let decodedCookie = decodeURIComponent(document.cookie);
            let ca = decodedCookie.split(';');
            for(let i = 0; i <ca.length; i++) {
                let c = ca[i];
                while (c.charAt(0) == ' ') {
                    c = c.substring(1);
                }
                if (c.indexOf(name) == 0) {
                    return c.substring(name.length, c.length);
                }
            }
            return "";
        }
        // Check if cookie from plugin "Cookies and Content Security Policy" exists
        if (checkCookie('cookies_and_content_security_policy') == true) {
            consent_cookie = getCookie('cookies_and_content_security_policy');
    
            if (consent_cookie.includes("statistics")) {
                // Google Analytics allowed
                gtag('set', 'ads_data_redaction', false);
                gtag('consent', 'update', {
                    'ad_storage': 'granted',
                    'analytics_storage': 'granted',
                    // 'functionality_storage': 'granted',
                    // 'personalization_storage': 'granted',
                    // 'security_storage': 'granted',
                });
            } else {
                // Google Analytics disallowed
                gtag('set', 'ads_data_redaction', true);
                gtag('consent', 'default', {
                    'ad_storage': 'denied',
                    'analytics_storage': 'denied',
                });
            }
        } else {
            // Cookie from plugin "Cookies and Content Security Policy" doesn't exists
        }
    </script>
    
    • This reply was modified 2 years, 8 months ago by mypixels.
    • This reply was modified 2 years, 8 months ago by mypixels.
    • This reply was modified 2 years, 8 months ago by mypixels.
    Thread Starter mypixels

    (@mypixels)

    I see.

    Theoretically, this could be hooked up to https://developers.google.com/tag-platform/devguides/consent#gtag.js consent status and passed on only with users consent.

    Thread Starter mypixels

    (@mypixels)

    Thank you!

    Hello,
    I think that’s the same issue as I’ve described here. Looking forward to solution. This plugin is otherwise perfect ??

    I have exactly the same problem. When I’m creating a new post (with Permalinks Customizer plugin active), the post slug is saved like “automatically-created-concept” instead text entered in post title.

    Situation is the same with Gutenberg or Classic editor. When is your plugin disabled, everything works good – slug is made from text entered in “title”.

    Second bug: slug for every new page is saved like “uncategorized/page-title” which is weird because I hadn’t even set rewrite rule for pages.

    Plugin itself is excelent (it’s fast!) for me, except this bugs which make it unusable.

Viewing 11 replies - 1 through 11 (of 11 total)