Recently I came across one of the interesting feature "Track Page Load Time" in Google Analytics APIs.
This feature provides the metrics on the Page Load Time within the Site Speed Report. This gives us a good opportunity to identifying slow loading pages and fix them for improving the Search Engine Ranking as load time is one of the factor in the page ranking.
Following is the code snippet for capturing the Page Load Time:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview'],['_trackPageLoadTime']);
(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>
Note that by default Site Speed Reports are not enabled. The function call _gaq.push['_trackPageLoadTime']) enables this report.
Showing posts with label Google Analytics. Show all posts
Showing posts with label Google Analytics. Show all posts
Thursday, May 19, 2011
Tuesday, December 28, 2010
Google Analytics on SharePoint
Seeing the title we might feel that what is the big deal in using Google Analytics on SharePoint content management sites, yes we can get the page views by just embedding few lines of code provided by Google Analytics site.
In the Current implementation we went with a different approach for providing flexibility to Content Authors to manage the Custom Variables, Events and so on...
At a high level following image shows you the flow:

At a high level we used following components in SharePoint which are the inputs to Google Analytics APIs
1. Custom Site Columns
There a set of site columns created for the publishing pages. Few of them are grouped with the group name called "MetaTagGroup". All the columns which are part of this group will be converted to Metatags.
We used a delegate control in SharePoint for generating these meta tags. For more info you can refer to the article on Meta tag generator
Following image shows the set of custom Site Columns mapped to MetaTagGroup

Now the content author has a flexibility to define the values for these Site Columns or Publishing page attribute which inturn converted Meta Tags and then passed to Google Analytics variables as explained in the next step.
2. Additional javascript layer on Google Analytics APIs
An additional javascript functions are created to call respective Google Analytics APIs. And also this javascript contains an array to map Meta tag name with the GA variables, Scope and their slots as shown below:
var arrGAVariables = [
{'GAVariable':'Segment-Type', 'MetaTagName':'Segment-Type', 'Scope':3, 'Slot':3},
{'GAVariable':'Target-Audience', 'MetaTagName':'Target-Audience', 'Scope':1, 'Slot':1},
{'GAVariable':'Business-Technology', 'MetaTagName':'Business-Technology', 'Scope':3, 'Slot':4}
];
Please feel free to contact me to get more insights on this implementation.
In the Current implementation we went with a different approach for providing flexibility to Content Authors to manage the Custom Variables, Events and so on...
At a high level following image shows you the flow:

At a high level we used following components in SharePoint which are the inputs to Google Analytics APIs
1. Custom Site Columns
There a set of site columns created for the publishing pages. Few of them are grouped with the group name called "MetaTagGroup". All the columns which are part of this group will be converted to Metatags.
We used a delegate control in SharePoint for generating these meta tags. For more info you can refer to the article on Meta tag generator
Following image shows the set of custom Site Columns mapped to MetaTagGroup

Now the content author has a flexibility to define the values for these Site Columns or Publishing page attribute which inturn converted Meta Tags and then passed to Google Analytics variables as explained in the next step.
2. Additional javascript layer on Google Analytics APIs
An additional javascript functions are created to call respective Google Analytics APIs. And also this javascript contains an array to map Meta tag name with the GA variables, Scope and their slots as shown below:
var arrGAVariables = [
{'GAVariable':'Segment-Type', 'MetaTagName':'Segment-Type', 'Scope':3, 'Slot':3},
{'GAVariable':'Target-Audience', 'MetaTagName':'Target-Audience', 'Scope':1, 'Slot':1},
{'GAVariable':'Business-Technology', 'MetaTagName':'Business-Technology', 'Scope':3, 'Slot':4}
];
Please feel free to contact me to get more insights on this implementation.
Subscribe to:
Posts (Atom)