Title: Tagamanager code
Last modified: August 31, 2016

---

# Tagamanager code

 *  [neiltomlow](https://wordpress.org/support/users/neiltomlow/)
 * (@neiltomlow)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/tagamanager-code/)
 * 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://wordpress.org/plugins/cookie-notice/](https://wordpress.org/plugins/cookie-notice/)

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

 * ![](https://ps.w.org/cookie-notice/assets/icon-256x256.png?rev=3549327)
 * [Compliance by Hu-manity.co](https://wordpress.org/plugins/cookie-notice/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-notice/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-notice/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-notice/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-notice/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-notice/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [neiltomlow](https://wordpress.org/support/users/neiltomlow/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/tagamanager-code/)
 * Status: not resolved