Google Analytics Integration
Support for the newer Universal Analytics is available in our source code repository and in mojoPortal 188.8.131.52 or higher. You should not change to use the new code in your site until AFTER your site is fully migrated to Universal Analytics. The old code snippet will still continue to work so no data will be lost. The old code snippet is deprectated so once your analytics property has completed the migration to Universal Analytics you should update to the new code snippet. To do that globally for all sites in your installation, you can out this.config file:
<add key="GoogleAnalyticsForceUniversal" value="true"/>
If for some reason you don't want to change it for all sites in the installation, you can also enable it from the layout.master file in the skin like this:
<portal:AnalyticsAsyncTopScript ID="analyticsTop" UseUniversal="true" runat="server" />
Keep in mind that once you change the main script to the new Universal Analytics, then you need to update any manual extra tracking code that you may have added in your site content such as tracking for outbound link clicks.
Legacy Information below
As of version 184.108.40.206, mojoPortal content management system 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 CMS 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. In mojoPortal you don't need to do this.
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, I recommend that you force a preferred host name, to keep your reporting 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.
You can also get charts and reports from Google Analytics Data right in your site by purchasing our add on product In Site Analytics Pro.
I recently discovered the Google Analytics Channel on YouTube and watched every one of the videos. I highly recommend you do the same as it helped me a great deal in getting better data from my reports. The new custom advanced segments opens up a lot of really great power to understand your traffic.
Also Conversion University is a great resource for learning google analytics.