ArcGIS Enterprise Sites and Google Analytics

03-17-2020 06:37 AM
New Contributor III

Hi ,
in my Company, we are having some issues in monitoring via Google Analytics a web page created with ArcGIS Enterprise Sites.

These were our actions:

  • we have created an Enterprise Site

  • in the edit section, we have entered the Google Analyics tracking ID for one of our google accounts (img. 1)

  •  we have configured our Google Analytics account and its property with the complete site URL
    -> but is not accepted, the error is "the URL must not contain fragment" (img. 2)

  • so we try to insert up to fragment and is accepted by the system

        -> we check the monitoring of the monitoring of the pages by sending test traffic (img. 3)
        -> the site mangement page opens but not traffic is detected

Since the tracking functionality via Google Analytics would natively exist, we are here to asking how to solve and
what we're doing wrong.

Thanks a lot in advance for the help.

14 Replies
Occasional Contributor II

Hi all, we have the same problem and it's a huge problem... any info about release plans ?

At this time the only workaround that we have found is to embed a small js page with the GA codes, in every Sites's page. It works but clearly only for pages where you can embed an iframe: all the major components of Portal for ArcGIS (map viewer, scene viewer, gallery page etc) cannot be monitored.

0 Kudos
New Contributor

Hi, can you tell us more about your workaround ? How do you embed GA js code into Arcgis Site pages ?



0 Kudos
New Contributor II

Would you mind sharing more details of this workaround?  I am interested in what code you inserted and where within the site page to make this work.

New Contributor III

@AlfonsoDodero ,

What version of ArcGIS Enterprise were you using?  I am unable to find where you can add a Google Analytics key to an Enterprise Site.... I see it in ArcGIS Online hubs...



0 Kudos
New Contributor II

I threw the gtag.js script into the index.html file located in C:\Program Files\ArcGIS\Portal\apps\sites on the enterprise server and it seems to be tracking.

Note you need to create a new property in Google Analytics with your enterprise domain, then grab the global site tag you have. Since I only put it on the "sites" specific index.html file, I believe it will only be tracking any ArcGIS Site that I create.

If I want to set it up for the entire domain (ie: the GIS home page and all sub pages), I might try injecting the script into the index.html within "C:\Program Files\ArcGIS\Portal\framework\webapps\arcgis#home", though I haven't tested that yet.