• Hi,
    I would like to add a tagmanager code when the cookies are excepted. The way I do it now isn’t the way, I found out: insert the tagmanager code in the area of the Refuse button-option.

    The following happens.
    This code:

    if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) {
    <!-- Google Tag Manager -->
    <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-T8CJPC"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-T8CJPC');</script>
    <!-- End Google Tag Manager -->
    }

    will be trimmed to this code after saving:

    if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) {
    <!-- Google Tag Manager -->
    
    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-T8CJPC');
    <!-- End Google Tag Manager -->
    }

    How and where do I need to insert this code properly.

    Thanks

    https://www.ads-software.com/plugins/cookie-notice/

  • The topic ‘Tagamanager code’ is closed to new replies.