Sitecore Experience Analytics Google Chart

Wednesday, November 23, 2016 @ 11:50

By: Scott Gillis, Lead Consultant – Why require your team to login to multiple systems just to review collected analytics?

This solution contains a SPEAK 2.0 component that allows for custom Google Analytic reports to be displayed within a dashboard page right in xAnalytics.

This is the exact source code as seen at the Sitecore Symposium 2016 talk 'Experience the Singularity of Data' and re-shown during a live webinar in October (get the full replay at https://www.paragon-inc.com/bringing_google_analytics_and_sitecore_together).

You can download the source to play with along with Sitecore install packages from the GitHub repo https://github.com/gillissm/Paragon.Sitecore.ChartByGoogle.

What's Included

  • TDS project for Sitecore artifacts
  • Two branches of code
    1. MASTER – targets Sitecore 8.2 Initial Release, and is built using the new dependency injection pattern
    2. Sitecore_81 – targets Sitecore 8.1 update 3, and should work with any version that supports SPEAK UI 2.0
  • Sitecore package as found in _Documents folder
    1. If you are running Sitecore 8.1 install the Sitecore package 'Paragon.Sitecore.ChartByGoogle_8.1.zip'
    2. If you are running Sitecore 8.2+ install the 'Paragon Sitecore ChartByGoogle_82-1.zip'
Image One

How to Use

  1. Install the included Sitecore package or sync via TDS. This only should be installed on a CM server!
  2. Login to Google Anayltics and create a service account, see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
  3. Save the .JSON and .P12 files provided to the data folder on the CM server
  4. Update the following values in z.Paragon.GoogleAnalyticsChart.config:
    1. JsonService with the file name of the .JSON
    2. P12Service with the file name of .P2 file
    3. AccountEmail wiht the email address supplied as part of the service account created
  5. The Google API assemblies have a dependency on Newtonsoft.Json version 7 so you must update your web.config with the following:
    <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="7.0.0.0" />
    </dependentAssembly>
  6. Open Sitecore Expierience Analytics and you should find a new report page named 'Google Anayltics'
  7. Add the new control as needed to new pages.

 

 

Scott Gillis, Lead Consultant at Paragon and 2017 Sitecore MVP, has been working with Sitecore for several years. He has a deep passion for helping clients leverage their content and data into powerful new capabilities in Sitecore and has produced successful outcomes as the technical lead on numerous, complex implementations. Recently, Scott has been focusing on helping these clients take advantage of the wealth of data collected by Sitecore Experience Analytics.