• Resolved Insect Trojan

    (@insecttrojan)


    hello can i add on host-analyticsjs-local/includes/frontend/class-tracking.php

            gtag('consent', 'default', {
                'analytics_storage': 'denied',
                'ad_user_data': 'denied',
                'ad_storage': 'denied',
                'functionality_storage': 'denied',
                'ad_personalization': 'denied',
                'security_storage': 'granted',
                'wait_for_update': 15000
            });

    and on update

                gtag('consent', 'update', {
                    'analytics_storage': 'granted',
                    'ad_user_data': 'granted',
                    'ad_storage': 'granted',
                    'functionality_storage': 'granted',
                    'ad_personalization': 'granted'
                });

    it will make any error or i can do this ? but the problem is on update it will erase can you make any setting to have the users this option ? thanks a lot @daanvandenbergh

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    You can add additional parameters to the Consent Mode using filters. analytics_storage and wait_for_update are already set. So, in order to add the additional parameters, you could use the following code in either your theme’s functions.php or a custom plugin.

    To update the defaults block:

    function daan_add_consent_mode_defaults() {
    ?>
    gtag('consent', 'default', {
    'ad_user_data': 'denied',
    'ad_storage': 'denied',
    'functionality_storage': 'denied',
    'ad_personalization': 'denied',
    'security_storage': 'granted'
    });
    <?php
    }

    add_action('caos_frontend_tracking_consent_mode_defaults', 'daan_add_consent_mode_defaults');

    And to update the update block:

    function daan_add_consent_mode_update() {
    ?>
    gtag('consent', 'update', {
    'analytics_storage': 'granted',
    'ad_user_data': 'granted',
    'ad_storage': 'granted',
    'functionality_storage': 'granted',
    'ad_personalization': 'granted'
    });
    <?php
    }

    add_action('caos_frontend_tracking_consent_mode_listener_update', 'daan_add_consent_mode_update');

    I haven’t tested this, so beware of syntax errors, but this should do it!

    Thread Starter Insect Trojan

    (@insecttrojan)

    thanks a lot @daanvandenbergh i will test it

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

The topic ‘consent mode v2’ is closed to new replies.