Advertisement

RouteViewer 3.0 plugin

Table of contents

Introduction

You can show your route with its places of interest on your own site using the RouteViewer 3.0 plugin. There are three versions of this plugin.

Free RouteViewer plugin

Via the RouteYou website

  1. On www.routeyou.com, surf to the route you want to show on your website.
  2. Click    Share.
  3. Click Embed.
  4. Copy the code.
  5. Paste the code into the HTML of your own website.

Getting started

This version is iframe-based. To add it to your site, add the following code where you want the plugin to appear:

<iframe src="//plugin.routeyou.com/routeviewer/free/?language=en" width="800" height="500" frameborder="0" allowfullscreen></iframe>

You can change the iframe's width and height to suit your website.

Configuring the plugin

The parameters should be passed in the URL of the iframe. Numbers, strings and booleans can be passed in a simple key=value pattern. Complex values can be passed as JSON encoded strings (remember that these will then need to be URL-encoded as well).

You can find the list of parameters in the "Parameters" section. For the free version, not all parameters are available. The available parameters are marked with .

Example

The example below will show you the route 'Walking in Ghent'. Both the interface and the route's data will be in English.

<iframe src="//plugin.routeyou.com/routeviewer/free/?language=en&amp;params.route.id=44" width="800" height="500" frameborder="0" allowfullscreen></iframe>

Basic version (iframe)

Getting started

This version is iframe-based and works the same way as the free version. To add it to your site, add the following code where you want the plugin to appear:

<iframe src="//plugin.routeyou.com/routeviewer/basic/?token=<your RouteYou web service token, see below>&amp;language=en" width="800" height="500" frameborder="0" allowfullscreen></iframe>

You can change the iframe's width and height to suit your website.

Configuring the plugin

The parameters should be passed in the URL of the iframe. Numbers, strings and booleans can be passed in a simple key=value pattern. Complex values can be passed as JSON encoded strings (remember that these will then need to be URL-encoded as well).

You can find the list of parameters in the "Parameters" section. Some parameters are not applicable to this version. The available parameters are marked with .

Upgrading from the free version

To upgrade from the free version, simply change the /free/ part in the URL to /basic/ and add your key or token (see below) to the list of parameters.

For example, if you currently have this:

<iframe src="//plugin.routeyou.com/routeviewer/free/?language=en&amp;params.route.id=44" width="800" height="500" frameborder="0" allowfullscreen></iframe>

You will need to change it to this:

<iframe src="//plugin.routeyou.com/routeviewer/basic/?key=<your RouteYou web service key, see below>&amp;language=en&amp;params.route.id=44" width="800" height="500" frameborder="0" allowfullscreen></iframe>

Example

The example below will show you the route 'Walking in Ghent'. Both the interface and the route's data will be in English.

<iframe src="//plugin.routeyou.com/routeviewer/basic/?token=<your RouteYou web service token, see below>&amp;language=en&amp;params.route.id=44" width="800" height="500" frameborder="0" allowfullscreen></iframe>

Advanced version (JavaScript)

Getting started

To add the advanced version of the plugin to your site, two pieces of code need to be added. First, you need to provide HTML div elements where the RouteViewer components will be placed. You can set their id's to any name you prefer, but make sure they are unique. You can position these divs in any way that fits your site design. The example code below will put the title first, then the profile above the map and the detail component (which will contain a.o. the route's and POIs' description and media) on the right of both the profile and the map. You can omit any component by not creating a div for it and not passing a div id in the configuration object.

RouteViewer components

<div id="routeYouRouteViewerTitle"></div>
<div id="routeYouRouteViewerDetail" style="margin-left: 10px; width: 300px; float: right;"></div>
<div id="routeYouRouteViewerProfile" style="margin-bottom: 10px;"></div>
<div id="routeYouRouteViewerMap"></div>

Second, add the JavaScript code that launches the plugin. To minimise the load time of your page, it is best to put this code as far down the page as possible.

<script type="text/javascript" src="//plugin.routeyou.com/routeviewer/3.0.js"></script>
<script type="text/javascript">
RTY.RouteViewer.load({
        'token': '<your RouteYou web service token, see below>',
        'language': '<your language, see below>',
        'title.div': 'routeYouRouteViewerTitle',
        'profile.div': 'routeYouRouteViewerProfile',
        'map.div': 'routeYouRouteViewerMap',
        'detail.div': 'routeYouRouteViewerDetail'
    });
</script>

Tabs

You can also show a tabbed version of the RouteViewer plugin. Use the code below for a similar layout as above, but with added tabs for download and lodging.

<div id="routeYouRouteViewerTitle"></div>
<div style="margin-left: 10px; width: 300px; float: right;">
    <div id="routeYouRouteViewerTabButtons" style="margin-bottom: 10px;"></div>
    <div id="routeYouRouteViewerTabPane"></div>
</div>
<div id="routeYouRouteViewerProfile" style="margin-bottom: 10px;"></div>
<div id="routeYouRouteViewerMap"></div>
<script type="text/javascript" src="//plugin.routeyou.com/routeviewer/3.0.js"></script>
<script type="text/javascript">
RTY.RouteViewer.load({
        'token': '<your RouteYou web service token, see below>',
        'language': '<your language, see below>',
        'title.div': 'routeYouRouteViewerTitle',
        'profile.div': 'routeYouRouteViewerProfile',
        'map.div': 'routeYouRouteViewerMap',
        'tabButtons.div': 'routeYouRouteViewerTabButtons',
        'tabPane.div': 'routeYouRouteViewerTabPane',
        'tabPane.components': ['detail', 'download', 'lodging']
    });
</script>

Route planner

By adding a few more settings to the tabbed version of the RouteViewer plugin, you can turn it into a full-fledged route planner. Use the code below for a similar layout as above.

<div style="margin-left: 10px; width: 300px; float: right;">
    <div id="routeYouRouteViewerTabButtons" style="margin-bottom: 10px;"></div>
    <div id="routeYouRouteViewerTabPane"></div>
</div>
<div id="routeYouRouteViewerProfile" style="margin-bottom: 10px;"></div>
<div id="routeYouRouteViewerMap"></div>
<script type="text/javascript" src="//plugin.routeyou.com/routeviewer/3.0.js"></script>
<script type="text/javascript">
RTY.RouteViewer.load({
        'token': '<your RouteYou web service token, see below>',
        'language': '<your language, see below>',
        'profile.div': 'routeYouRouteViewerProfile',
        'map.div': 'routeYouRouteViewerMap',
        'tabButtons.div': 'routeYouRouteViewerTabButtons',
        'tabPane.div': 'routeYouRouteViewerTabPane',
        'tabPane.components': ['suggest', 'detail', 'download'],
        'suggest.enable': true
    });
</script>

Configuring the plugin

To further configure the plugin, add parameters from the "Parameters" section below as needed to the JavaScript object. Some parameters are not applicable to this version. The available parameters are marked with .

Some important guidelines:

Styling the plugin

The plugin will automatically use the CSS of the surrounding page, which means fonts, colors and most other styling will match your website. Some tips and important guidelines:

Mobile-friendly

The plugin can be made responsive (different settings on small and large screens) by setting a responsive breakpoint with the layout.breakpoints parameter. Contact sales[at-r.] for more information.

Example

The example below will show you the route 'Walking in Ghent'. Both the interface and the route's data will be in English.

<script type="text/javascript" src="//plugin.routeyou.com/routeviewer/3.0.js"></script>
<script type="text/javascript">
RTY.RouteViewer.load({
        'token': '<your RouteYou web service token>',
        'language': 'en',
        'title.div': 'routeYouRouteViewerTitle',
        'profile.div': 'routeYouRouteViewerProfile',
        'map.div': 'routeYouRouteViewerMap',
        'detail.div': 'routeYouRouteViewerDetail',
        'params.route.id': 44
    });
</script>

Parameters

Some parameters are not available in all versions. Each parameter is marked with the version(s) in which it is available:

General

Content

You can decide what to show with the following parameters.

Layout and behaviour

The plugin adapts to the height of the user's browser window or the iframe. When resizing, the map takes the height of the title and profile into account, while the detail, download, statistics and lodging components take the height of the tab buttons and title into account. The following parameters influence this behaviour.

Colors and more

The following parameters change the style (color scheme and related properties) of all components.

Media

The following parameters change the behaviour of the route and place of interest media.

Title component

Profile component

Map component

Detail component

Download component

Statistics component

Lodging component

Tabs

Links

By default, the download button links back to the RouteYou website. The following parameters influence this behaviour.

Compatibility

The RouteViewer 3.0 plugin is compatible with all major browsers. However, to ensure full compatibility, it is vital that the pages on which you place the plugin begin with a valid DOCTYPE, for example:

<!DOCTYPE html>
<html ...

Plans & pricing

For a list of the RouteYou functionalities per type of account, take a look at the RouteYou Functionality Overview per account type.

Back to RouteYou

© 2006-2023 RouteYou - www.routeyou.com