As of version 18.104.22.168, mojoPortal now includes advanced integration with Google Analytics. Google provides you with a basic script that you can use to track page views in your site, it looks like this:
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
Historically, in mojoPortal and in other ASP.NET sites, you could always put this script into the bottom of your masterpage, in mojoPortal, that would be the layout.master file in your skin. This would get you basic tracking and it was very easy to do. Now in the current version of mojoPortal, you just enter this part "UA-xxxxxxx-x" from the script provided by google into your Site Settings under (key icon) Administration Menu > Site Settings > API Keys like this:
of course your code will be different than "UA-xxxxxxx-x", that just represents the format of your tracking code.
If you are using a custom skin, the only other requirement is to put this in the bottom of your layout.master file just before the closing form tag:
<portal:mojoGoogleAnalyticsScript ID="mojoGoogleAnalyticsScript1" runat="server" />
All the skins included in mojoPortal already have this so if you are using one of those you don't have to do anything other than the site setting above.
mojoPortal will automatically setup the script and it will do a lot more than the basic script.
One of the first advantages, is that it doesn't matter if you change skins or use different skins on different pages, the script will just work as long as the skin has the needed control. So for example in the past, unless you also put your google analytics script into the printerfriendly skin, it wasn't tracking page views when users clicked the printer friendly link, but now it does. THis also helped me with tracking traffic on demo.mojoportal.com, in the past I never bothered tracking that site because users could always change the skin and it was tedious to have to put my tracking code in all the skins. Now I just set it in user.config, you can set it there like this and it will trump the one in site settings : <add key="GoogleAnalyticsProfileId" value="UA-xxxxxxx-x" />. The only reason I use it on the demo site is so that no-one can change it in site settings and affect my tracking. I mean people get to login to the demo site as admin after all. Of course for multi site installations you want to always use the sitesettings.
In addition to the convenience of not having to maintain tracking codes in all your skins, mojoPortal will automatically label your visitors as Members if they are registered on your site, and if they make a purchase in WebStore or the Event Calendar Pro features they will be labelled as Customers. You will see this under the "User Defined" section of reports beneath Visitor reports. mojoPortal will also track ecommerce transactions in Google analytics from WebStore and from Event Calendar Pro features.
Site Search is also tracked, but to take advantage of it you need to configre your settings in google analytics like this:
Note that you just enable it and set "q" as the Query Parameter. Now you will start to capture data in the Site Search Reports beneath the Content Reports.
You can also enable tracking of page load time by setting this in your Web.config or user.config: <add key="TrackPageLoadTimeInGoogleAnalytics" value="true" /> Unfortunately, as of the time of this writing, you won't see this yet in your google analytics reports unless you are in their beta program. But, by starting to capture data now, you will see it later when event reports come out of the beta process.
Another thing you can do is capture the google analytics data into your own IIS or apache web logs by setting this in Web.config or user.config: <add key="LogGoogleAnalyticsDataToLocalWebLog" value="true" />
To get any value out of this data you would need to get google Urchin and use it to analyze your web logs. Another reason to capture this data in your logs is because google analytics only keeps your data for 25 months.
If you have more than one host name that your site responds to like mojoportal.com and www.mojoportal.coom, recommend that you force a preferred host name, to keep your reportng consistent.
Since anyone can view the rendered source of a page and see your tracking code, its possible for someone else to put your code in their site and create bogus data in your reports. To avoid this, after forcing a preferred host name, I recommend that you set a filter on your google analytics profile. Click the Add Filter link:
then configure it like this:
I'm really just learning about all the possibilities for taking full advantage of Google Analytics, I've learned what I have so far from the top book in this picture and hope to learn more ways to make it easy to get good tracking integrated into mojoPortal.