Answers.Body: <p>You should just be able to put it in a text field and then output it in an <a href="http://buildwithcraft.com/docs/templating/includejs" rel="nofollow"><code>includeJs</code></a> statement. So, add a new global set (called 'googleAnalytics' or whatever); create a text field (called 'text' or whatever); and add the new field to your global set field layout.</p>
  
  <p>In your template you should be able to access it by the globalSet handle.</p>
  
  <pre><code>{% includeJs googleAnalytics.text %}
  </code></pre>
  
  <p>Not tested, but I don't see any reason it shouldn't work. If the <a href="http://buildwithcraft.com/docs/templating/includejs" rel="nofollow"><code>includeJs</code></a> statement doesn't like that for some reason you can try the following instead.</p>
  
  <pre><code>{% set GACode %}
      {{ googleAnalytics.text }}
  {% endset %}
  {% includeJs GACode %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T17:09:46.253Z
Answers.Text: I tried this. What should be the correct field type for the text? I tried both Plain text and Rich Text. Both don't seem to work.
Answers.UserDisplayName: Anya Dit
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-08T20:13:14.880Z
Answers.Text: I would suggest plaintext. You may also need to use `raw` filter, so that it is not HTML encoded (i.e. `{{ googleAnalytics.text|raw }}`)
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-19T00:55:25.097Z
Answers.LastActivityDate: 2015-02-19T15:48:38.543Z
Answers.LastEditDate: 2015-02-19T15:48:38.543Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>can anyone tell me step by step what to do to put google analytics code into a global field? I have read the earlier answer but i am new to craft and i don't know where to start. </p>
  
Tags: <analytics>
Title: How do i put google analytics code into a Global field?
ThreadText: # How do i put google analytics code into a Global field?
  
  (Asked by: username_0 on 2015-02-18)
  
  can anyone tell me step by step what to do to put google analytics code into a global field? I have read the earlier answer but i am new to craft and i don't know where to start.
  
  **Tags:** analytics
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-19. Score: 5
  
  You should just be able to put it in a text field and then output it in an [`includeJs`](http://buildwithcraft.com/docs/templating/includejs) statement. So, add a new global set (called 'googleAnalytics' or whatever); create a text field (called 'text' or whatever); and add the new field to your global set field layout.
  
  In your template you should be able to access it by the globalSet handle.
  
  ```
  {% includeJs googleAnalytics.text %}
  
  ```
  
  Not tested, but I don't see any reason it shouldn't work. If the [`includeJs`](http://buildwithcraft.com/docs/templating/includejs) statement doesn't like that for some reason you can try the following instead.
  
  ```
  {% set GACode %}
      {{ googleAnalytics.text }}
  {% endset %}
  {% includeJs GACode %}
  
  ```
  
  > **Comments:**
  > **username_2**: I tried this. What should be the correct field type for the text? I tried both Plain text and Rich Text. Both don't seem to work.  
  > **username_1**: I would suggest plaintext. You may also need to use `raw` filter, so that it is not HTML encoded (i.e. `{{ googleAnalytics.text|raw }}`)  
  
  ---
  
  