Skip to main content

How to identify the current page information via JavaScript

Learn how to figure out the current page info (e.g. page type, theme template, etc) in JavaScript for advanced, conditional customizations and box rendering, such as different placements for certain PDP templates.

Updated this week

LimeSpot populates a LimeSpot.PageInfo global object on JavaScript that helps you identify the current page and additional details about its context including Page Template and the Reference information (e.g. Product Identifier on a PDP page).

Here are a few examples of this object on a Shopify store:

Home Page:

{
"Type": "Home",
"Template": "index",
"ReferenceIdentifier": null
}

Product (PDP) Page:

{
"Type": "Product",
"Template": "product",
"ReferenceIdentifier": "392926355"
}

Collection Page:

{
"Type": "Collection",
"Template": "collection",
"ReferenceIdentifier": "260494360665",
"Personalized": false
}

Search Page:

{
"Type": "Search",
"Template": "search",
"ReferenceIdentifier": null
}

Did this answer your question?