Döcu Content

Google Analytics JavaScript/Xpages

Classic Asynchronous Script


Introduction:

Döcu Content now includes a Google Analytics Asynchronous Script to record user experience in the App. It is necessary to create an account prior, if none is available, to be able to view Google Analytics report. You will be given the Script upon completion of account set up to add to Xpages files.


Disclaimer:

Information contained in the following is presented as is. This tutorial assumes you have basic Lotus Notes Configuration knowledge, and are familiar with Google products.


Döcu Content Classic Analytics Script

Google Analytics Classic Script code still works brilliantly, we recommend using this version until the Beta version is stable. Please grab the Script file to add to All pages in your software, follow instructions below to view reports, areas of interest have been highlighted for your convenience.


Please note, there are some notable differences between the Classic and Beta version of the Script. For this exercise, we are using a localhost address. In order for your version of the script to work, when creating your App on a localhost server, append additional code to your script. See Instructions below...


Install Classic Script, see screenshots for areas of interest

  1. Go to: http://www.google.com/analytics/ and create a new account, if you haven't already

  2. For this exercise, you will need the Classic version of the Script

  3. Add a Generic account name (not your Google Account Info)

  4. Plug in your website name and URL, note the default for LocalHost addresses

  5. Grab the Asynchronous code and plug into your App

  6. Do create a JavaScript Library to reference in your Xpages

  7. Create a test Xpages form to test the Script, run the Xpage in your Browser

  8. Wait about 24 hours to see the results via own Google Analytics Dashboard pages



Copy and Paste Asynchronous Script


Pay attention to the differences between the Classic and Beta version, with the Classic version, you do need to add the following snippets.


_gaq.push(['_setDomainName', 'none']);

_gaq.push(['_setAllowLinker', true]);


You could eiher add the code to a Script file or reference right onto the pages within <script></script> tags, however we recommend using a ScriptLib to do this; helps to separate code from design, keep it standard and clean.

TIP: If you have an actual website, you would therefore remove the snippets mentioned, Google knows how to reference your App to your Script. In your case, you would also need to append your own UA code here: UA-XXXXXXXX-X ...


analytics.js;

//AppName: Döcu Content

//Program: analytics.js

//Purpose: Track User Experience in Xpages App

//version: 2014.01.03.12.30.PM

//@author: Dököll Solutions, Inc.

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);

_gaq.push(['_setDomainName', 'none']);

_gaq.push(['_setAllowLinker', true]);

_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);

})();


Reference Script file in Xpages form





Pick a Date to view Reports


Google provides a Dashboard page to alow viewing of our reports. You may need to customize your version to view visits at your linking, example, by day, week, or month. You can also drill down to Countries, Cities, Type of ISP and so to give you a sense of your page visits. We recommend making your site pages inviting and helpful so visitors stay on a little bit longer. More importantly, you might want to make such pages load quicker than the average, and easy to reach site so your users do not lose interest before actually getting to see your stuff.




View Reports after 24 Hours of Submission (Site Visits)


In our experience, visits made by your users are recorded along with our own visits. You should probably stay off your website to have further control as to whom actually are visiting your website




TIP: You should refresh your Xpages form(s), or visit the page(s) where the Script is referenced, a number of times as a test... just to be sure your visits are recorded in test; since you must wait about 24 hours to view results anyway.


Conclusion:

You can now reference Google Analytics in your Xpages to report user visits to your dashboard; information that can be used to help you better service your users.


Questions, comments, please post a brief message on our Contact form on the main site.


Thank you for coming...

Version:2014.01.21.10.12.PM