Why Good JavaScript Code Is Critical To Your Locator

Whether you are using our MySLP SaaS service or our WordPress plugins for Store Locator Plus, having a web page that is loading “clean” JavaScript code is CRITICAL to the functionality of your locator.   Most web pages today, and certainly those including an interactive map, are far removed from static HTML and images.   Today’s web pages are full-on applications.   They are programs that are running locally on your device to draw a page that looks similar to the old-time static HTML pages but with a lot more cool interactions; like maps.

While these new interfaces are cool and certainly make the web easier to use they come at a cost.   It requires that all of the little mini-applets that you are loading on a page to show to your users play nicely together.   Every single interactive component like that Google Ads sidebar, the Recaptcha validation and maps are all separate programs that are playing in the same “pool”.    The problem with this is that it is very easy for any one of those components to “go haywire” and spoil the fun for everyone else.

Part of the issue is that for most web page builders you have ZERO control over WHEN you get your turn to jump in the pool.   Do you get in first?   Or do you get in after someone left their “code turd” in the pool?   How well your app runs can depend a lot on WHEN it gets to run.  To make matters more complicated an interactive page may not “sprout new problems” until AFTER the user starts interacting with the page.   Maybe it happens when a user clicks on an ad that is being tracked which then breaks the code and all subsequent JavaScript is running in a “polluted pool”.

Often the Store Locator Plus map is the most visual an interactive element on the page.  It happens to be what most people notice first when JavaScript is broken.   You won’t notice if your ad-click is not being tracked but you sure as heck notice when you try to look up locations and the map doesn’t change.    Often the cry goes out “you broke the locator” when many times it is something else that broke well before the locator had a chance to do its work.

Check For JavaScript Code Errors

Use your web browser developer tools.   All modern browsers have this functionality and it can give you some clues as to what is really going on.    If you see errors in the console you will want to clean this up and see if it resolves the issues with the locator.

Safari

Go to Safari | Preferences | Advanced and click “Show Develop menu in menu bar”.

Safari Turn On Dev Tools
Safari Turn On Dev Tools

 

To check your JavaScript Console go to Develop | Show JavaScript Console

Look for any red exclamation marks and look at the error logs to suss out JavaScript code issues.

JavaScript Code Errors In Web Console
JavaScript Code Errors In Web Console

Firefox

Older versions of Firefox have the web developer tools enabled by default.  If you do not see the Web Developer menu option check under the Settings menu a this may be disabled by default in future releases.

To view possible JavaScript errors:

Go to Tools | Web Developer | Web Console

 

Learn More In This Video

Check out this video to learn more about the technical details of why JavaScript loading order and errors in other JavaScript code is important.

 

If you are not seeing JavaScript code errors on your page and your Store Locator Plus map is still not working please contact us!

Experience 4.9.1 | Shortcode Attributes and Settings Patch

Version 4.9.1 of the Experience add on for WordPress  has been released today.   The issues cited here do not affect MySLP service users.

Shortcode Attributes and Checkbox Settings

A bug was patched in Experience 4.9.1 that was triggered when using the [slplus] shortcode with any extra attributes.  For example [slplus center_map_at=”My Town”] would trigger the issue as would [slplus only_with_category=”Retail”].

Prior to 4.9.1 using any attribute in the slplus shortcode would turn OFF the following settings regardless of how they are set in the main Store Locator Plus settings tab:

  • allow_addy_in_url
  • disable_initial_directory
  • hide_address_entry
  • hide_map
  • immediately_show_locations
  • ignore_radius
  • show_maptoggle

Experience 4.9.1 will work with older versions of the Store Locator Plus base plugin, however we recommend you upgrade SLP, Experience, Power, and Premier to the latest 4.9.1 release to address other issues that have been patched in the past 2 weeks.

We are still working on known issues with categories and tags and hope to have a 4.9.2 series of patches out next week.

Location Import Process Improved With Power 4.9

With the release of the WordPress plugins version 4.9 of Store Locator Plus and the Power add on we focused on improving the location import process for large lists.      MySLP Power users will see this release by the end of the year after it has passed full testing on our SaaS platform.

Why Did We Change The Process?

Prior to version 4.9 there were a number of limitations that could prevent larger lists of locations from importing properly.    For the fastest servers with lots of memory and super-fast networking as well as a premium tier on the Google API service, Store Locator Plus could import 40,000 locations without any problem.

As WordPress started adding more network overhead, all those update notifications and the news feed in the WordPress dashboard comes from somewhere, the network started to become an issue.   On top of that Google started tracking every single map request so they could start charging people using their maps on a per-lookup basis.     Both of these changes increased the network traffic, slowing down how quickly Store Locator Plus could get a latitude/longitude for those new locations being imported.

Often your server would give up, saying “you had your 30 seconds of my time” and stopping the import mid-stream.    The PHP time limitation on processing is often the first thing that “gives out” when importing large lists of locations.   For most shared hosts the limit is 30 seconds.   Even on a dedicated host it is good practice to not let a PHP process consume more than 120 seconds of CPU time.  This prevents “runaway” processes that take over the entire server which can grind EVERYTHING to a halt forcing a server restart.

The bad news is that if you are importing 10,000 locations and the process gives up after 9,800 locations you have to start over.   At least that is how it USED TO BE with SLP 4.8 and earlier.

How Imports Improved In Power 4.9

With version 4.8 the location import process was “tied to the browser” until it was complete.    When you clicked the “upload CSV” button your browser would sit there attached to the website while the file was uploaded, read line-by-line, each location sent to Google to get a latitude and longitude and then get added to the Store Locator Plus locations list.     If the network was slow this could take a long time, often 10 minutes or more.   That is FOREVER to keep a browser window open these days.

With Power 4.9 we split this process into 3 stages.

Stage 1 : Get The File On The server

This is the only step of the process that stays “attached to your browser”.    The browser will bar processing the page while the file is copied from your laptop to the web server.   This is typically a quick process even for a file with 250,000 locations.    The time it takes depends on how fast your local network and ISP connection is.

Previous versions stored  the uploaded location files in a “hidden” SLP-specific directory under WordPress uploads.   Version 4.9 stores them in the media library.     This gives you an easy way to see that the file was uploaded properly, see what the current import state is, and later download or delete the files when the import is complete.

Stage 2 : Import The Locations Into SLP

After the file is uploaded a detached process starts to work on the actual location import. This ensures your browser doesn’t time out as this part happens in the background.    Your browser is “free to go” while your server does the work of loading in the locations.

It runs a WP Cron job in the background to import the locations WITHOUT geocoding. This is much faster and ensures the import doesn’t disconnect partway through.

As part of improving visibility into this process, Power 4.9.1 will be out soon and will be included in our end-of-year MySLP update.  It includes a cool interactive progress bar as well showing you how many records have been read.

Power 4.9.2 Import Processing Progress
Power 4.9.2 Import Processing Progress Bar

If your server times out before our background location loader finishes reading the file , SLP remembers the last record read and re-spawns a new background job to pick up where it left off. It will do this until it reaches the end of the file no matter how often PHP times out.

Stage 3: Geocode The Locations

AFTER the file has been loaded it will then geocode all uncoded locations.   That means you may catch SLP with a list of locations none of which are geocoded and not showing up on the map.  This is a temporary state while SLP talks to Google.    Since that is always the slowest part of an import we decided to do this in a separate process so at least SOME locations start showing up right away and eventually of them are loaded.

Power 4.9.2 Geocoding Progress
Power 4.9.2 Geocoding Progress

This is similar to the import. It does it in the background and if PHP times out it will re-spawn itself until it has tried to geocode very location at least once. This is a big step toward not having an import time out. It also keeps you from manually having to re-geocode if you hit your daily 2500 location limit and didn’t opt for a paid API key.