Skip to main content
Participant
February 10, 2010
Question

Google Analytics in Master Pages

  • February 10, 2010
  • 2 replies
  • 1103 views

Is there a way to add the Google Analytics tags to Master Pages so that they all get updated with the tag?

Thanks in advance.

    This topic has been closed for replies.

    2 replies

    Captiv8r
    Legend
    February 11, 2010

    Hi there

    It might be possible to achieve using Master Pages. But I'm unsure about what is expected. Can you supply us with the code you wish to add and tell us where the code should end up in the topic?

    Cheers... Rick

    Helpful and Handy Links

    RoboHelp Wish Form/Bug Reporting Form

    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!

    Adobe Certified RoboHelp HTML Training

    SorcerStone Blog

    RoboHelp eBooks

    February 12, 2010

    Yes using master pages is an easy way to go for Google analytics.

    I apply the master page as part of the publish and put any other headers and footers I want in the same .htt file.

    Put the google code in the HTML body in rh-region footer.

    The relevant part is this: (extract from xxx.htt):

    ..

    <body>

    ....

    <?rh-region_start type="footer" style="width: 100%; position: relative;" ?>
        <script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script>
        <script type="text/javascript">try {
    var pageTracker = _gat._getTracker("UA-1234567-1");
    pageTracker._trackPageview();
    } catch(err) {}</script>
    <?rh-region_end type="footer" ?>

    ...
    </body>

    regards,

    Peter

    Peter Grainge
    Community Expert
    Community Expert
    February 11, 2010

    If you edit a master page, it only updates the header and footer of existing topics. Could you not use a multi file find and replace tool? Work on a copy of the project to try it.


    See www.grainge.org for RoboHelp and Authoring tips

    @petergrainge

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.