The mParticle SDK allows you to track the location of your users. When you are tracking location, the SDK will include a
location node as part of each event uploaded by the SDK. The
location node converts data from iOS, Android or Web into a single standard and has three properties:
50means the device is within 50 meters of the specified latitude and longitude.
This location data serves two main purposes
A small number of output partners consume location information directly for each event.
For each batch of event data received from the SDK, mParticle extracts location data from the first event with a non-null location, performs a reverse geo-lookup and adds the following metadata to the batch:
New York, New York,
If you have not logged location information, mParticle will still attempt a reverse geo-lookup based on the IP Address of the batch. The last 30 days of location information are available in the Audience tool and can be used to define audiences.
There are two ways to approach location tracking:
startLocationTrackingmethod and let the mParticle SDK collect and update location information for you. Remember to call
stopLocationTrackingwhen you no longer need to track location
locationproperty directly. In this case you are responsible for maintaining
locationupdated and setting it to
nil/nullwhen no longer needed
startTrackingLocation() initializes HTML 5 Location Tracking. The user will be prompted to allow access to location. The mParticle SDK will then start listening to the location events. Thereafter, the location will be appended to events are sent to the mParticle servers.
//start tracking location mParticle.startTrackingLocation(); //stop tracking location mParticle.stopTrackingLocation(); // manually set coordinates that were retrieved from another source mParticle.setPosition(40.71, 74.00);
Was this page helpful?