November 3, 2015

Plassering av GTM Tag

Update 2017: The GTM documentations has been revised to state that the tag should be in the head, as high as possible. Read the GTM Quck Start Guide for an authorotive guide to installing the GTM script.

Google Tag Manager kan puttes i head for å begynne den asynkrone innlastingen hurtigere.

    <html>
      <head>
      <title>Sidetittel</title>

        <script src="innloggingslinjen.min.js?"></script>

        <script>
        <!--  noen sider ligger det statiske data -->
        navno.fgkode = 'XXXX';
        navnno.ytelse = 'YIT´;
        </script>

        <!-- FØR VAR DET GA HER, NÅ ER DET GTM -->
        <script>
      var dataLayer = dataLayer || [{
         securityLevel: navno.securityLevel || 0,
         fgKode: navno.fgkode,
         ytelse: navno.ytelse
       }];

    (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-PM9RP3');
        </script>

      </head>
      <body>
      <!-- Ikke her -->
      </body>
    </html>

Caïn venant de tuer son frère Abel, by Henry Vidal in Tuileries Garden in Paris, France. CC BY 2.0 Alex E. Proimo

© Tov Are Jacobsen 1997-2021 Privacy and cookies