You can display links on your Website that link directly to specific searches of your interface.  To do this, you can add URL parameters to the page on which the MetaLocator code is hosted.  These special URL parameters will be passed into the MetaLocator interface code on that page and interpreted as part of the search.

In this example, an interface is displayed on as shown here:

If we want the page to automatically pre-populate the postal code field in the postal code search box, we can add a URL parameter as follows:

If we want to pre-populate the search box and perform the search automatically, we must add a radius, and the task parameter as follows:

Note that the URL parameter prefix is "ml" followed by 3 underscores.  Any form variable can be included this in this manner.

To link directly to the location with ID number 12,

To automatically check category check-boxes, use the following syntax, where 99 and 100 are the ID of the category, as shown in the ID column under Categories in the MetaLocator Control Panel.[]=99&ml___tags[]=100

You can also use this method to create your own search form.

A simple HTML example follows, where locator.html is the page on which your MetaLocator interface is deployed.

<input id="postal_code" type="text" />
 <input type="button" id="btn_submit" onclick="window.location.href='locator.html?ml___task=search_zip&ml___radius=200&ml___postal_code=' + document.getElementById('postal_code').value;" value="Submit" />

Passing Javascript Variables

An Interface can also accept parameters via a javascript variable declared above the Interface installation  code as follows:

var ml___params = {};

The ml___params array can contain any URL-parameter option as described above.  For example, this declaration would cause the City option to be pre-selected as Milwaukee and the keyword pre-populated to "smith".

var ml___params = {"city":"Milwaukee","keyword":"smith"};


Parameters, as written it the URL or in the ml___params  array can be any of the following:

  • lang: The language file to load.  E.g. en-GB (1) 
  • type: Filter where records have a certain value of the system type field.
  • radius: The search radius.  This should be a numeric value, e.g. 50 
  • id: The id of a specific location.  This will filter results down to a specific location.
  • view: The view is directory  by default, but can be overridden as location  when linking to a single specific location.
  • limit: The maximum number of results to return
  • limitstart:  The numeric offset of results.  E.g. If 5 is provided for limitstart and 10 is provided for limit, the system will return 10 results starting from the 5th result.
  • tags: Provided as an array of ID values.  The values should correspond to the ID of the category (a.k.a tag) as shown in the back-end under Data > Categories.
  • keyword: Provided as a string to search all data fields for a given keyword.  
  • task: If provided with a value of search_zip, this will trigger a search to be performed.  E.g. "task":"search_zip"  or in the URL as ml___task=search_zip 
  • fieldname : Any field name shown under Data > Fields.  The fieldname should be the "safe" field name as shown under Field Details > Template Markup, without the curly brackets.  So "address":"123 MetaLocator"  would filter records to show where the address field equals 123 MetaLocator.

Overriding Interface Settings

You can also override Interface settings by constructing an ml___options array.  The settings provided in this array will be overlapped, or merged with the values of the target interface.

 var ml___options = {

In the above example, the map base TLD has been changed to "DE" and the weather units have been changed to imperial.  To discover the allowable names and values for this settings, it is necessary to inspect the Interface settings as shown below:

Privacy Opt-out

You can disable MetaLocator tracking of analytics data by passing  _opt_out=1 as a parameter to your Interface.  This prevents MetaLocator from tracking analytics data and setting cookies.  This is useful for when the user has already opted out of allowing cookies to be set elsewhere on your website, and you would like that existing preference respected within the MetaLocator IFRAME.  

This disables the analytics system and would therefore allow the user to browse anonymously.  This will artificially deflate page views, hits and other events tracked by our analytics system.  Similarly, this may also cause the user to be prompted for their location multiple times, as it can no longer be stored in a cookie.

Did this answer your question?