2 Replies Latest reply on Sep 9, 2015 1:58 PM by mark_baum

    Want to add meta tags via custom templates to pass user info to Omniture

    mark_baum

      We're on Jive 7 hosted.

       

      We've got the basic Omniture snippet working in Jive, but want to pass the User ID (when logged in) using a meta tag. I'm having trouble getting that to work.

       

      1)

      I've got a Javascript snippet pasted into the Third-Party Analytics form:

       

      document.write(unescape("%3Cscript src='//assets.adobedtm.com/[long string]/satelliteLib-[long string].js' type='text/javascript'%3E%3C/script%3E"));

       

      2)

      The end of my custom template /soy/template/css-custom.soy is this:

       

                <script type="text/javascript">_satellite.pageBottom();</script>

          {/literal}

      {/template}

       

      3)

      And I've also got some javascript earlier in /soy/template/css-custom.soy

       

      var fmID = (_jive_current_user.ID == -1) ? '' : _jive_current_user.ID ;

      //document.write(unescape("%3Cmeta name='jiveidsc' content='" + fmID  + "'%3E"));

      document.write(unescape("%3Cmeta name='jiveidsc' content='1234'%3E"));

       

      You can see that at this point I'm just trying to pass the value "1234" in a meta tag as a test.

       

       

      Omniture is supposed to pick up the value in this meta tag and include it.  Does the approach I'm trying even make sense?

       

      Has anyone else succeeded at adding meta tags using custom templates?

       

      Thanks!

       

      Mark

        • Re: Want to add meta tags via custom templates to pass user info to Omniture
          mark_baum

          Now I've found /soy/template/meta.soy ,  and I've successfully added a static meta tag to it.  But I really want to do something like:

           

              <meta name="jiveidsc" content="{$currentUser.id}"/>

           

          But since that isn't passed as a parameter, I can't. Do I have any options here? Or could I make this work in another soy template where this data point is available?

           

          -----

                         

          {namespace jive.skin.template.header}

           

           

          /**

          * Meta information in the header

          *

          * @param characterEncoding

          * @param metaKeywords

          * @param metaDescription

          */

          {template .meta}

              <meta http-equiv="Content-Type" content="text/html; charset={$characterEncoding}" />

              {if $metaKeywords}<meta name="keywords" content="{$metaKeywords}" />{/if}

              {if $metaDescription}<meta name="description" content="{$metaDescription}" />{/if}

              <meta charset="utf-8" />

              <meta name="jiveidsc" content="1234"/>

              <!--[if IE]><![endif]-->

          {/template}

            • Re: Want to add meta tags via custom templates to pass user info to Omniture
              mark_baum

              We got it working. Here's our solution:

               

              1)

              Change /soy/template/css-custom/soy, placing the initial Site Catalyst call there (NOT in 3rd party analytics)

               

              {namespace jive.skin.template.header.css}

               

              /**

              * A template to override to inject custom css.

              */

              {template .custom}

                   {literal}

               

              <script src='//assets.adobedtm.com/[long string]/satelliteLib-[long string].js' type='text/javascript'></script>

               

              ...

               

               

              2)

              Change /soy/template/template.soy, placing the "_satellite.pageBottom();" as close to the end of the body as possible:

               

                   {if $kMetricsView.enabled}{$kMetricsView.footerScript|noAutoescape}{/if}

                      {if $adRollView.enabled}{$adRollView.script|noAutoescape}{/if}

                      {if $timingView.footer}{$timingView.footer|noAutoescape}{/if}

               

                    <script type="text/javascript">_satellite.pageBottom();</script>

               

                  </body>

               

                  </html>

               

              {/template}

               

              /**

              * This template will render content shown in a div or iframe.

              *

              ...

               

              3)

              In the Site Catalyst's Dynamic Tag Management, set up an Edit Page Load Rule with the following:

               

              var randomNumber=Math.floor(Math.random()*11111)

              var tempHost=window.location.href;

              var referrer = document.referrer;

              s.prop10="rand|"+randomNumber+"|time|"+Date.now()+"|url|"+tempHost+"|referrer|"+referrer+"|jiveID|"+_jive_current_user.ID;

               

              (Note: with this we are attempting to make Site Catalyst treat each data row as unique. If you don't want to do that, then leave out the random number part.)

               

              Hooray! We are getting this data point into Site Catalyst now!