Customize and extend your embedded store locator with our JavaScript API. Listen for events, trigger actions, and create seamless integrations between your application and the Storepoint widget.
Get Started →Find your unique embed code (and public widget ID) on the 'Embed Locator' page in your dashboard.
Get Embed CodeBasic implementation example:
<!-- Place the widget container wherever you want the store locator to appear -->
<div id="storepoint-widget"></div>
<!-- Place these scripts before the closing body tag -->
<script src="https://widget.storepoint.co/embed.js"></script>
<script>
var storepoint = new StorepointWidget('YOUR_PUBLIC_WIDGET_ID', '#storepoint-widget', {
// Optional configuration options
});
</script>
Remember to replace 'YOUR_PUBLIC_WIDGET_ID' with your public widget ID, or use the embed code directly from your dashboard embed locator page.
This shows a simplified synchronous loading version. The default embed code from your dashboard uses async loading for better performance. You can implement your own async loading too - just remember to initialize the widget after the embed.js script has loaded.
Sets the locator widget's display language using a two-letter ISO language code (e.g. 'en', 'es', 'fr'). The language must be configured first in your Language Settings.
Only languages that have been configured in your dashboard settings will work. Make sure to set up your desired languages and translations in the Language Settings page before using this method.
// Example: Change to French (if configured in dashboard)
storepoint.setLanguage('fr'); // ISO code for French
// Example: Change to Spanish (if configured in dashboard)
storepoint.setLanguage('es'); // ISO code for Spanish
Programmatically sets active filters on the widget.
storepoint.setFilters(['featured', 'premium']); // Activates these filter tags
Subscribes to widget events. The callback function receives event-specific data.
storepoint.on('search', function(data) {
console.log('Search performed:', data);
});
Triggered when a search is performed.
storepoint.on('search', function(data) {
// data contains:
// {
// lat: number|null, // Latitude of search point
// lng: number|null, // Longitude of search point
// query: string, // Search text
// type: string, // Search type (e.g., 'initial_search', 'filter_change')
// storepoint_location_id: number|null, // ID of nearest location
// distance: number|null, // Distance to nearest location
// tags: string[]|null // Active filter tags
// }
});
Triggered when a location in the results list is clicked.
storepoint.on('location-result-item-click', function(data) {
// data contains location details
});
Triggered when a location marker on the map is clicked.
storepoint.on('map-marker-click', function(data) {
// data contains location details
});
Triggered when an online store link is clicked.
storepoint.on('online-store-click', function(data) {
// data contains:
// {
// store_name: string, // Name of the online store
// store_link: string // URL of the online store
// }
});
Triggered when the widget initially loads.
storepoint.on('load', function(data) {
// data contains:
// {
// url: string, // Current page URL
// referrer: string // Referrer URL
// }
});
Triggered when a search returns no results.
storepoint.on('no-results', function(data) {
// Useful for implementing fallback behavior
window.location.href = '/store-not-found';
});
We're constantly expanding our API capabilities. Contact us to discuss your specific needs or request new features.
Contact us at [email protected]