More in this section

Forums / General Discussions / Google Analystics Control - Sitefinity pages and Widgets

Google Analystics Control - Sitefinity pages and Widgets

2 posts, 0 answered
  1. Larry Brindise
    Larry Brindise  avatar
    6 posts
    Registered:
    15 Jun 2010
    20 Oct 2010
    Link to this post
    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!
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 Oct 2010
    Link to this post
    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
2 posts, 0 answered