[oXygen-user] Adding a Google Analytics code for our xHTML output
Oxygen XML Editor Support
support at oxygenxml.com
Mon Jan 20 03:02:45 CST 2014
Hello,
You should create a file with your XHTML code for Google Analytics and
set the path of this file in the parameter called webhelp.head.script in
the DITA Webhelp transformation. The Webhelp transformation inserts the
content of the file set in the webhelp.head.script parameter in the
<head> element of each output Webhelp page.
If you need to insert some JavaScript code in the <body> element of each
page you can use the parameter called webhelp.body.script. The value of
the parameter is the file path of a file containing the XHTML code that
will be inserted at the beginning of the <body> element.
The parameters webhelp.head.script and webhelp.body.script can be used
in the same Webhelp transformation and we used both parameters for our
internal Webhelp transformations when we needed to add Google Analytics
code to the Webhelp pages. You can use only one of them if it works for
you to insert the whole JavaScript code either in <head> or in <body>.
Best regards,
Sorin
http://www.oxygenxml.com
Scott Barney wrote:
> We are using DITA and DITA-OT with the oXygen WebHelp plug-in to create
> our online documentation (with a customized DTD).
>
> We would like to use Google Analytics to track our Web page usage.
> According to my webmistress, we will need to include our Google
> Analytics tracking code (which looks something like UA-99999999-9) in
> each page output.
>
>
>
> The code that we’ve added for our other Web pages appears similar to
> this (account number has been modified in this example):
>
>
>
> <script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js">
>
> <script type="text/javascript">
>
> var _gaq = _gaq || [];
>
> _gaq.push(['_setAccount', 'UA-29999999-2']);
>
> _gaq.push(['_trackPageview']);
>
> (function() {
>
> var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
>
> ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
>
> var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
>
> })();
>
> </script>
>
>
>
> Is there an option in the WebHelp plug-in that would allow us to simply
> add this type of code to the <head> element? Or could it possibly be as
> simple as adding proper metadata to our DITA files?
>
>
>
> Thanks,
>
>
> Scott
>
>
>
> Description: Four Js - The Power of Simplicity
>
> *Scott Barney – Content Manager / Information Architect / Technical
> Writer / Instructional Designer*
More information about the oXygen-user
mailing list