Jane Docs
Search…
Embedded Query Params
Pre-filter your menu or deep link to a specific product page
Both deep linking to a specific product page and pre-filtering a menu require embedding a script into the menu’s host webpage. This script will interact with the iframe to navigate to the correct page within the menu when the user clicks the relevant link.
After embedding the script (see the end of this document), all you need to do is add a ?path= to the embedded url, where after the ?path= you grab the path of the product or filter parameter.

Linking to a specific product

  1. 1.
    Go to https://www.iheartjane.com/embed/stores/{STORE_ID}
  2. 2.
    Click on the product you’d like to deep link to. This will generate a URL like this:https://www.iheartjane.com/embed/stores/319/products/52729/kings-garden-banana-og?recommended=false&fromMenu=true
  3. 3.
    Copy the entire URL after the STORE_ID:
    products/52729/kings-garden-banana-og?recommended=false&fromMenu=true
  4. 4.
    Append the copied snippet to the URL of the host page:
    https://peoplesorangecounty.com/?path=products/52729/kings-garden-banana-og?recommended=false&fromMenu=true

Pre-filtering

Pre-filter your menu to display, e.g., all edibles:
  1. 1.
    Go to https://www.iheartjane.com/embed/stores/{STORE_ID}
  2. 2.
    Click on the filter you’d like to apply. This will generate a URL like this:
    https://www.iheartjane.com/embed/stores/319/menu?refinementList%5Broot_types%5D%5B0%5D=edible
  3. 3.
    Copy the entire URL after the STORE_ID:
    menu?refinementList%5Broot_types%5D%5B0%5D=edible
  4. 4.
    Append the copied snippet to the URL of the host page
Live example:

Script to Embed

The script that powers both deep linking and pre-filtering is below. Please remember to replace all instances “STORE_ID” with the id of your store.
1
2
<script id="jane-frame-script" src="https://api.iheartjane.com/v1/stores/STORE_ID/embed.js"></script>
3
<script>
4
var getParams = function (url) {
5
var params = {};
6
var parser = document.createElement('a');
7
parser.href = url;
8
var query = parser.search.substring(1);
9
var vars = query.split('&');
10
11
for (var i = 0; i < vars.length; i++) {
12
var pair = vars[i].split('=');
13
if(pair.length > 2) {
14
params[pair[0]] = decodeURIComponent(pair[1] + '=' + pair[2]);
15
}
16
else {
17
if (params['path']){
18
params['path'] += "&" + decodeURIComponent(pair[0] + '=' + pair[1]);
19
} else {
20
params[pair[0]] = decodeURIComponent(pair[1]);
21
}
22
}
23
}
24
return params;
25
};
26
var baseURL = "https://www.iheartjane.com/embed/stores/STORE_ID/";
27
var params = getParams(window.location.href);
28
if(params['path']){
29
var newSrc = baseURL + params['path'];
30
document.getElementById('jane-menu').src = newSrc;
31
}
32
</script>
33
34
Copied!
Last modified 7mo ago