Select to view content in your preferred language

Where to add the Google Analytics script to a Web App Builder (on locally hosted server) site?

6558
6
Jump to solution
09-15-2015 10:23 AM
JasonBuck
Occasional Contributor

I am trying to add the Google Analytics script to a locally hosted Web App Builder site.  I've put the script in the Index.html file.  According to the  network traffic the site is sending information to Google Analytics, however, no users are being logged.  Is using Google Analytics with a web app builder site allowed or has anyone gotten this to work?  If so, is there a specific location where the script needs to be placed?  Thank you.

Jason Buck

La Crosse, WI

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Jason,

   I have this in the head section of my index.html and I get analytic data.

  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i=i||function(){
    (i.q=i.q||[]).push(arguments)},i.l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-My code', 'auto');
    ga('send', 'pageview');

  </script>

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Jason,

   I have this in the head section of my index.html and I get analytic data.

  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i=i||function(){
    (i.q=i.q||[]).push(arguments)},i.l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-My code', 'auto');
    ga('send', 'pageview');

  </script>
0 Kudos
JasonBuck
Occasional Contributor

Robert,

Thank you.  That's where I have it as well.  After checking Google Analytics again, I just realized that the date range being displayed didn't include today.  It was actually tracking.  Thank you for the confirmation on the script location.

Jason

IanGrasshoff
Regular Contributor

Hey Jason!

I happened to stumble across this thread.  Thought you might find this useful for the future

GitHub - igrasshoff/esri-wab-widget-google-analytics: A google analytics widget & template for use i... 

mohannainar1
Emerging Contributor

Hi Robert,

I found a widget https://github.com/igrasshoff/esri-wab-widget-google-analytics. Do you have any idea on this. 

I added the widget in WAB developer edition. When I launch the application not able to view the widget

 

0 Kudos
JeromeAlano
New Contributor

ESRI builder makes it very complicated just to include google analytics

0 Kudos
JeromeAlano
New Contributor

Its very frustrating how ESRI builder having difficulties just to include google analytics. Does anyone here successfully integrated their google analytics to their Dashboard?

 

0 Kudos