Closed Bug 941666 Opened 11 years ago Closed 10 years ago

Add region tracking to Google analytics

Categories

(Marketplace Graveyard :: Statistics, defect, P2)

Avenir
x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED
2014-01-21

People

(Reporter: robhudson, Assigned: spasovski)

References

Details

(Whiteboard: [qa-][feature])

We're switching from our own internal installs tracking to google analytics (bug 938897) but we'd like to track installs within regions. I'm told we aren't tracking region currently. Can we include this as a custom variable that we then can use in app install reports for the custom event of "Successful app install"?
I'll look into it.
Blocks: 941762
Right now there's three places where we set the region, but it's not a great plan to import tracking in all of those places. Instead, I'm going to create a setup where you can fire tracking events and set variables:

z.win.trigger('track', ['user_var', 'region', region]);
Blocked on bug 943539 since that's going to change the way we determine your region.
Depends on: 943539
Scrapping my idea from comment #2. Instead, we're going to fire an event ('regionchange'?) when the region might have changed. That can keep track of whether the region now reflects a different value (it might not if we're not relying on a region fallback, like the SIM card). From there, we can post directly to tracking.
Blocks: 950790
Davor: I'll let you implement this however you want. The simplest way, IMO:

- Set up a z.window.on('regionChange') event in user_helpers that talks to the tracking module
- z.trigger('regionChange', [...]) from mobilenetwork.js in detectNetwork
- You can either fire the event in user_helpers or just call the method directly if you put the tracking code in there. user_helpers is where the geoip region gets set.

What I explicitly wouldn't do is just say `tracking.setVar('region', user_helpers.region())`. If you're doing that on initialization, there's a small chance that you'll have saved the region before yule log posts the SIM card data to mobilenetwork.js and a 100% chance that the client won't have an updated geoip region.
Awesome advice for the fireplace side of things. If we set a region in mobilenetwork.js would that be all that's required from GA's perspective? Does it start a tracking session where installs are now aware of the region? Not sure if you're the right person to ask.
setVar should set a tracking variable that lasts the duration of the session. In contrast, setPageVar (which has the same function prototype) sets a tracking variable that lasts the lifetime of the current page.

Note that both also handle the case of UA, where they set dimensions rather than variables.
Assignee: nobody → dspasovski
Priority: -- → P2
Target Milestone: --- → 2014-01-14
Whiteboard: [qa-]
https://github.com/mozilla/fireplace/commit/ce72960
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: 2014-01-14 → 2014-01-21
Whiteboard: [qa-] → [qa-][feature]
You need to log in before you can comment on or make changes to this bug.