Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Map Load event to GL-JS #7297

Closed
lilykaiser opened this issue Sep 19, 2018 · 9 comments · Fixed by #7431
Closed

Add a Map Load event to GL-JS #7297

lilykaiser opened this issue Sep 19, 2018 · 9 comments · Fixed by #7431
Assignees

Comments

@lilykaiser
Copy link

What is requested in this change?
mapbox-gl-js will send a map load event when (and only when) the Mapbox access token is set, a Mapbox map is instantiated, and resources are loaded from a Mapbox API. This behavior will be the same as in the mapbox-gl-native SDKs for iOS and Android.

For each instantiation of a Mapbox GL map object, a map load will be accrued upon its first tile request to the Mapbox Maps API. Further requests made by that instance, e.g. those caused by user interactions such as zooming and panning, or by usage of runtime styling methods, will not generate additional map loads.

Other than the IP address, which is retained for a limited period of time per our privacy policy, no device identifiers will be sent as part of this event.

Why is this needed?
Today, we track how many maps we serve to our customers via API requests. We are adding map loads as a metric that isn’t biased by implementation of/interaction with maps, as API requests are. Additionally, tracking map loads will make our internal web usage metrics consistent with our internal mobile usage metrics.
We think carefully about all tracking we add to our developer tools, and only add what we believe helps us provide a better customer experience.

Can I opt out of this tracking?
If your use of mapbox-gl-js does not set the access token (using mapboxgl.accessToken) then this code is always disabled. When the access token is set, there is no option to disable this event.

@Fractaliste
Copy link

Does it means mapbox-gl-js could not be used anymore on closed private networks?

@leearmstrong
Copy link

Does this mean that Mapbox pricing for JS may well change from map tiles to map loads? Much like the Mapbox mobile SDK & Google Maps?

@lilykaiser
Copy link
Author

Hi @leearmstrong , that may be something we consider in the future, but was not the motivation for this ticket.

@Fractaliste I asked around and I don't believe this has any impact on closed private networks. If you are using your own tile server instead of Mapbox tiles, and are therefore not setting a Mapbox access token, this event wouldn't fire.

@Fractaliste
Copy link

You're talking about this load event: https://www.mapbox.com/mapbox-gl-js/api/#map.event:load right?

I still need it when I use no Mapbox token/api, otherwise I got some "Style is not done loading" errors when I dynamically add layers or sources.

@lilykaiser
Copy link
Author

@Fractaliste I am requesting a new event. The one you refer to would not be impacted and would not fire when a Mapbox token isn't set.

@andrewharvey
Copy link
Collaborator

I think there's a bit of miscommunication, Lily is referring to a tracking/analytics event to mapbox.com when you're using Mapbox services, the map load event, Fractaliste is referring to a JavaScript event called when the map is finished loading, they are different kinds of "events".

@stevage
Copy link
Contributor

stevage commented Oct 17, 2018

Is it too late to suggest a different name? This sounds confusingly similar to map.on("load" and map.loaded(), both of which have their own semantic confusions.

@mollymerp
Copy link
Contributor

@stevage – this won't be exposed at all so name collision shouldn't be an issue. I agree the issue title is a bit confusing, but we are talking about a telemetry event that will be sent to a mapbox endpoint (only if using mapbox tiles) for tracking usage.

@stevage
Copy link
Contributor

stevage commented Oct 17, 2018

Ah thanks. Sorry, I see that Andrew tried to clear that up but I missed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants