JavaScript Reference
General
html5.ready(callback)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback |
function |
Yes | -- | Function called when library has been initialized |
Specify a function to be called when the library and document has been loaded. When the registered callback function has been executed it is safe to call the other library functions.
html5.getClickTag(name)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
name |
string |
No | "clickTAG" |
Name of click tag parameter to get. See Multiple Landing Pages for more information. |
Returns a URL to use for redirecting to a specified landing page. Optionally takes a parameter with the name of a specific click tag to return. Please note that this function will not simply return a URL specified in your manifest.json
file, but will augment the URL with click tracking information. Therefore it is important to fetch the landing page URL using this method instead of specifying it in code.
html5.getVariable(name)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
name |
string |
Yes | -- | Name of variable to get. See Variables for type information. |
Either returns a value defined by you in your manifest.json
file, or a dynamically expanded macro variable. See Variables for more information.
html5.createClickTag(url)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
url |
string |
Yes | -- | URL of landing page to redirect to |
Returns a URL to use for redirecting to a dynamically specified landing page. Please note that you need to use this function if you wish to redirect the user to a custom landing page since it will augment the URL with click tracking information.
Geo
html5.geo.nearest(coords)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
coords |
list<coord> |
Yes | -- | List of object s with "latitude" and "longitude" entries |
Returns the nearest coordinate given the browser's current location as a reference point. Requires "$latitude"
and "$longitude"
as configured variables.
html5.geo.order(coord, coords)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
referenceCoord |
coord |
Yes | -- | Reference coordinate |
coords |
list<coord> |
Yes | -- | List of object s with "latitude" and "longitude" entries |
Returns a list of coordinates ordered by distance from the passed in reference point.
html5.geo.distance(a, b)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
a |
coord |
Yes | -- | Starting coordinate |
b |
coord |
Yes | -- | End coordinate |
Returns the distance between two locations in space in meters.
Product Feed
html5.products.all()
Returns products from product feed. Requires "$productFeed"
, "$products"
and optionally "$numberOfProducts
as configured variables.
Last modified: Mon Sep 23 2024 11:48:54 GMT+0200 (Central European Summer Time)