What is the Local Storage API?
This feature is available for customers that have multiple Sites under a single domain. One common use case is for Local Pages. Once enabled, we create and store an object in the visitor's browser (using Local Storage) containing relevant information about the last Site (and any Location details - city, state, phone number, etc) they visited.
This object should then be available from any page (i.e. the Corporate Site) as long as its within the same hostname (i.e. www.yourdomain.com).
Data example
The localSiteData
object is a stripped-down (does not contain all fields) JSON encoded version of our Site object.
Below is an example that contains commonly used fields.
Below are some descriptions of common use cases of this data.
Site
Accessed from the main localSiteData
object
Location
Accessed from localSiteData.locations[0]
Code examples
Parsing the data
Check if local site data is set
If you want to first check to see if localSiteData
is set before using it.
Simple example of updating a div
Example of updating a div in the header of the page with the
This would update the DOM with something like
Testing
For testing purposes, you will need to be in the same "domain" to get access to the localStorage data.
Last updated