November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Sam,
Have you had a chance to look at the user guide for GA ?
http://webhelp.episerver.com/addons/googleanalytics/#GoogleAnalytics/Developers_GoogleAnalytics.htm%3FTocPath%3D_____4
Hope it helps.
Hi Shahid,
Thanks for getting back to me. No I hadn't seen that guide, does it relate to both CMS6R2 and 7? In any case the domain wasn't altered in either my local or our test environment so I wrote my own method and which did a find and replace:
public static void GenerateEpiGoogleAnalytics(this PageBase page, HttpContext context)
{
string existingDomain = UriSupport.SiteUrl.Host.ToString();
string gaDomain = SiteSettings.GlobalHomePage.GoogleAnalyticsDomain;
ScriptBuilder scriptBuilder = new ScriptBuilder();
if (!scriptBuilder.ShouldAppendScript((HttpContextBase)new HttpContextWrapper(context)))
return;
bool requiresScriptReference;
string str = scriptBuilder.BuildTrackingScript(out requiresScriptReference, (HttpContextBase)new HttpContextWrapper(context), page.CurrentPage);
str = str.Replace(existingDomain, gaDomain);
page.Page.ClientScript.RegisterStartupScript(typeof(ScriptAppender), "CustomEpiGoogleAnalytics", str, true);
if (requiresScriptReference)
{
string webResourceUrl = page.Page.ClientScript.GetWebResourceUrl(typeof(ScriptAppender), "EPiServer.GoogleAnalytics.Scripts.Tracking.js");
page.Page.ClientScript.RegisterClientScriptInclude("EpiGat", webResourceUrl);
}
}
Is it possible to manually set the domain using this plugin?
We require tracking across multiple subdomains, so we need to set the domain to be at a higher level as per google's requirements (https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#domainSubDomains).
For example the site is uk.example.com, so we need to set it to example.com so users are tracked across all sites.
There is an option in the admin tool for 'One domain with multiple subdomain' - but this sets the domain to the full host.