Answers.Body: <p>This code will let you disable the inclusion of the tag:</p>
  
  <pre><code>{% do seomatic.script.get('googleTagManager').include(false) %}
  </code></pre>
  
  <p>For more, check out the <a href="https://github.com/nystudio107/craft-seomatic#twig-templating" rel="nofollow noreferrer">SEOmatic Twig Templating documentation</a></p>
  
  <p>If you're changing the inclusion of the tag or not based on some other variable such that the tag may be included or not for the exact same URI, you'll want to bust the cache, too (which is URI-based):</p>
  
  <pre><code>{% do seomatic.script.container().clearCache(true) %}
  </code></pre>
  
  <p>Also check out the <a href="https://nystudio107.com/blog/tips-for-using-seomatic-effectively" rel="nofollow noreferrer">Advanced SEOmatic Tips</a> article for some deeper reading.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-05T14:49:00.950Z
Answers.Text: Using clearCache gave me this error: `Calling unknown method: nystudio107\seomatic\services\Script::clearCache()`
Answers.UserDisplayName: Piotr Pogorzelski
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-05T19:58:47.120Z
Answers.Text: My bad, I left out the `.container()` -- I edited the answer
Answers.UserDisplayName: andrew.welch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-05T13:37:54.653Z
Answers.LastActivityDate: 2019-04-06T14:09:26.197Z
Answers.LastEditDate: 2019-04-06T14:09:26.197Z
Answers.UserDisplayName: andrew.welch
Body: <p>I am using Seomatic and i want to conditionally render google tag manager trancking code - or not. </p>
  
  <p>How do I disable it using some Twig template code?</p>
  
Tags: <plugin-seomatic>
Title: Seomatic - disable tag manager from inside template
ThreadText: # Seomatic - disable tag manager from inside template
  
  (Asked by: username_0 on 2019-04-05)
  
  I am using Seomatic and i want to conditionally render google tag manager trancking code - or not.
  
  How do I disable it using some Twig template code?
  
  **Tags:** plugin-seomatic
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-05. Score: 1
  
  This code will let you disable the inclusion of the tag:
  
  ```
  {% do seomatic.script.get('googleTagManager').include(false) %}
  
  ```
  
  For more, check out the [SEOmatic Twig Templating documentation](https://github.com/nystudio107/craft-seomatic#twig-templating)
  
  If you're changing the inclusion of the tag or not based on some other variable such that the tag may be included or not for the exact same URI, you'll want to bust the cache, too (which is URI-based):
  
  ```
  {% do seomatic.script.container().clearCache(true) %}
  
  ```
  
  Also check out the [Advanced SEOmatic Tips](https://nystudio107.com/blog/tips-for-using-seomatic-effectively) article for some deeper reading.
  
  > **Comments:**
  > **username_0**: Using clearCache gave me this error: `Calling unknown method: nystudio107\seomatic\services\Script::clearCache()`  
  > **username_1**: My bad, I left out the `.container()` -- I edited the answer  
  
  ---
  
  