Best Use Case for Google Analytics in WAB?

10058
24
11-14-2014 08:02 AM
BrianO_keefe
Occasional Contributor III

So I want to have Google Analytics for my WAB Maps. I realize this is a MUCH better environment for this than back in Flex (where you had to have widgets and such to do this) but I am curious what the best way to do this would be?

I have considered creating a WAB Template map that has Google Analytics code pre-populated requiring minor adjustments. I have considered trying my hand at a Widget (for several reasons). I have considered just editing the code once the WAB Map is completed.

Is there a recommended process for this? Or are we wild westing this stuff right now since WAB is still in BETA?

0 Kudos
24 Replies
MegPeterson
New Contributor III

Hi Sebastian -

I just wanted to thank you for posting this! I have GA running on my index.html but now need to track individual widget hits, so this post will be very helpful. (I may have questions as I go along....).

Thanks again for the info. - Meg

0 Kudos
DanielChantlos1
Occasional Contributor

This widget doesn't appear to open in WAB.

0 Kudos
IanGrasshoff
Occasional Contributor

That's right, it's not supposed to be visible to the user.  That's part of the changes I made to original when I forked it.  I didn't want it sitting in a menu somewhere for a user to click it wondering what it was for.  It's still logging to GA in the background.  Does that make sense?  I should update the README file in the repo...there really was nothing there from the original.

0 Kudos
BillSpiking__GISP
Occasional Contributor

Hi Ian,

I'm testing your branch of the GA widget in WAB 2.3 and the widget IS appearing within my app.  Maybe I'm deploying incorrectly?  Have you tested the widget in 2.3?

Thank you,

Bill

0 Kudos
IanGrasshoff
Occasional Contributor

Thanks...I haven't worked on it recently.  I believe I did notice this before.  I am thinking a simple hack would be to switch the widget icon to an blank image.  If I remember correctly, I was searching the UI components for a specific CSS tags that get injected by the WAB.  Problem is the Esri seems to change them between templates and versions.  I think the simplest way to handle it would be to switch the icon.  It will still occupy space on the header controller...but oh well. 

BillSpiking__GISP
Occasional Contributor

Not a problem Ian.  I think I'll try to make it an on screen widget and hide it using the code provided by Robert Scheitlin, GISP‌ . https://community.esri.com/thread/187640-hide-widget-icon 

0 Kudos
IanGrasshoff
Occasional Contributor

That's great, do you plan to fork my repo?

0 Kudos
BillSpiking__GISP
Occasional Contributor

I haven't tested yet, but I don't think any changes will need to be made to your code.  Just redeploying as on screen widget.

0 Kudos
StanMcShinsky
Occasional Contributor III

I just tried this on 2.3 and it was not letting me add the widget to the map and configure it. I just changed the name of the folder from "esri-wab-widget-google-analytics-master" to "GoogleAnalytics" in the WebAppBuilderForArcGIS\client\stemapp\widgets folder and all seams to be working now.

-Stan