Enrichment

You can enrich your own data in Glimr by passing in values for aggregation by the Glimr cloud. Currently only user position is supported. All values defined need to be flushed back to our servers. This is done with a call to Glimr.getTags.

.storePosition

Glimr.storePosition( position: { longitude: number | string, latitude: number | string } ): void

This signals the position of the user. The passed in object must have numeric longitude and latitude members. They can either be numbers or strings that can be parsed with parseFloat.

📘

Note

Stored values are not stored until flushed by a call to Glimr.getTags. See the example below to learn how to use it.

Example

Here is an example using navigator.geolocation to ask for local news and weather.

function getPosition() {
  navigator.geolocation.getCurrentPosition(function(position) {
    // Store position
    Glimr.storePosition({
      latitude: position.coords.latitude,
      longitude: position.coords.longitude
    });

    // Flush position with request to server
    Glimr.getTags("YOURID", function(tags) {
      // use new possibly more accurate tags
      console.log("Tags are now", tags);
    });
  });
}
<a onclick="getPosition()" href="javascript:void(0)">Do you want local news and weather?</a>