Google Analystics Control - Sitefinity pages and Widgets

Posted by Community Admin on 03-Aug-2018 21:49

Google Analystics Control - Sitefinity pages and Widgets

All Replies

Posted by Community Admin on 20-Oct-2010 00:00

We are evaluating very strongly Sitefinity 4.  We like it for the same reasons most developers like it - homogenous development environment, use of Telerik controls, etc. 

We also currently use Google Analytics within a much older (static) web site. 

I am currently reworking portions of this site in preparation for placing all of our ticket-sales e-commerce pages within a SiteFinity web site.  I am doing a proof-of-concept whereby I convert all of our current pages into user controls so they can be SiteFinity widgets.  However, many of these pages depend on Master pages, and those master pages contain scripts that are used very commonly across many pages and user controls contained within those pages.

Specifically with Google Analytics, my understanding (I have not verified by testing) is that there is a stock widget in Sitefinity 4.0 that you simply include on pages.  I am expecting that this will probably be dynamically writing a ScriptBlock into the page. (?)  Usually these scriptblocks are written such that the .net page rendering engine guarantees a unique instance of a scriptblock for each ID specified within the scriptblock registration call. 
So, while I prepare my current project for Sitefinity, and keeping in mind I have a while before I can deploy within Sitefinity, and also keeping in mind that my current project must function in its current state until re-deployed within Sitefinity as user controls, I am wondering if anyone knows if the following will work:

In our current project, rework the haphazardly-placed "google-analytics.com/ga.js" scripts that are in current master pages in such a way that they are within a *.js file, then register that scriptblock using an ID that will match the ID that the Sitefinity Google Analytics control is using so the scriptblocks will not be duplicated.

Am I thinking clearly or is there something I'm missing?  Will this be possible?  Thanks!

Posted by Community Admin on 25-Oct-2010 00:00

Hello Larry Brindise @ The Phil,

Thank you for using our services.

We do have a built in control which allows you to paste the javascript which Google provides and the control will automatically render this script to your page. We register a start up script containing the provided Analytics js. When you try to add a script on a page which already has the control (may be added to the page's template) you will be notified that you cannot have duplicate GA scripts on the page. We perform a check if the page has a startup script of the type typeof(GoogleAnalyticsEmbedControl) and containing the key googleAnalytics registered.

You can use the GA script control on your pages inidividually, or add it to your templates so that all pages using set template will have this script added.

Greetings,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed