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 shopperlongitude
: the longitudinal coordinate of the shopperlocation_name
: the city and state of the shopperpostal_code
: the postal code of the shoppern_items_stocking_product
: number of dealers stocking this productn_items_stocking_upc
: number of dealers stocking this UPC (if supplied)dealers
: JSON formatted list of dealers with contentproduct_id
: Locally product identifier if found (or false if not)