Product Locator: Accessing Data Programatically

Brands will often want to be able to customize the user experience on their product detail pages based on the status of the Product Locator. The Product Locator will broadcast "events" containing information about it's current status to the HTML page in which it is embedded. In order to "listen" for these events, just add an event listener to the page:

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

Here is a typical event.detail output:

{
    id : 0,                            
    n_items_stocking_product : 3,      
    n_items_stocking_upc : 2,          
    dealers: {...},                    
    product_id: 21043                  
}


id: ID of the Product Locator [when using multiple Product Locators on the same page]

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.