Try our conversational search powered by Generative AI!

Google Analytics context gadget doesn't support multi-hostname websites or dedicated edit server

Found in

EPiServer.GoogleAnalytics 1.9.3.9000

Fixed in

EPiServer.GoogleAnalytics.1.10.4

(Or a related package)

Created

Nov 25, 2016

Updated

Nov 03, 2017

State

Closed, Fixed and tested


Description

Precondition: you have one of the following setups:
a) Multi-hostname website: you have different domains per language, for example, .dk, .se, .de.
b) Dedicated edit server with its own hostname (for example, edit.mysite.com) and front-end servers (for example, mysite.com).

Steps to reproduce
1) Install the Google Analytics add-on
2) Sign-in.
3) Add a context gadget in edit mode.
4) Try to open some pages with available analytics data.

Expected: Analytics data for the current page
Actual: Empty results.

There are two problems in "EPiServer.GoogleAnalytics.Controllers.Controllers.ControllerBase" class "ApplySegment" method:

1) GetPageUrl() returns absolute url for any preconditions and gadget controller filters out all received analytics data by "ga:pagePath==

{absoluteUrl}

" filter, because "ga:pagePath" dimension always contains only path without hostname.

Fix: Extract the path from absolute urls for "ga:pagePath" filter.

2) "ga:hostname" always contains the default site host. For any preconditions, it filters out all page analytics, because the page url hostname is different. For example, for edit server setup, you get the site host "edit.mysite.com", while the page host is "mysite.com". Or, in a multi-host scenario, site host is "mysite.com", but DK page url host is "mysite.dk".

Fix: Extract the hostname from the page url and use it for filtering.