title: how to add tag manager to head in vue.js
body: <p>I have a problem in my <code>vue.js</code> project. I have a function, which I have to add to head in my project. When I added in <code>index.html</code> my function (it is a function creating tagManager in head project) doesn't work property. So I tried to add in App.vue(the main file in vue components) in <code>mounted()</code>. But I still have a problem how to add this to tempate. My function is:</p>
  
  <pre><code> &lt;script&gt;
    (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" ? "&amp;l=" + l : "";
      j.async = true;
      j.src = "https://www.googletagmanager.com;
      f.parentNode.insertBefore(j, f);
    })(window, document, "script", "dataLayer");
    &lt;/script&gt;
  </code></pre>
  
  <p>I thought I will set this script in mounted and then do document.head.appendChild. But the function is too complicated, so I have a problem. Any idea how can add this script to my project's head?</p>