Product Locator: Accessing Data Programatically

Locally's Product Locator can broadcast "events" containing information about it's current status, such as location and nearby dealer status, to the HTML page in which it is embedded. This event is called `LOCALLY_data_update`. In order to "listen" for this event, add an event listener to the page. For example:

window.addEventListener("LOCALLY_data_update", function(event) {
// event.detail will contain an object will all location-related details
// act upon event.detail here ...
}, false);

The  lcly_event_data output contains the following:

{
id : 0,
   latitude: 53.546251     location_name: "Edmonton, AB"     longitude: -113.493297
n_items_stocking_product : 3,
n_items_stocking_upc : 2,
    postal_code: "T5K2E4"
product_id: 21043
}

DEFINITIONS

  • id: ID of the Product Locator [when using multiple Product Locators on the same page]
  • latitude: the latitudinal coordinate of the shopper
  • longitude: the longitudinal coordinate of the shopper
  • location_name: the city and state of the shopper
  • postal_code: the postal code of the shopper
  • n_items_stocking_product: number of dealers stocking this product
  • n_items_stocking_upc: number of dealers stocking this UPC (if supplied)
  • dealers: JSON formatted list of dealers with content
  • product_id: Locally product identifier if found (or false if not)

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.