Embeds
Embeds are ready-made components that add All Aboard features to your website, such as a list of journeys or of rail passes. They work with any web technology, are responsive, and follow current accessibility and security standards.
The Rail Pass List and Rail Pass Modal need nothing but an HTML snippet. The Journey List, Offer Selection and Refund Manager work together with a backend of your own, which creates the bookings and access tokens they act on. The Journey Cards and Rail Pass Cards show journeys and passes that your own code gives them.
Web Components
The embeds are built as Web Components: custom HTML elements that work in all modern browsers, and with any JavaScript library or framework.
Our embeds
To add an embed to your website, copy the snippet from its page and paste it into your HTML.
These embeds call the All Aboard API themselves, with the key or token you give them:
These embeds make no API requests. They show what your own code gives them, and need no key:
Test and live scripts
Each script talks to one environment. The scripts on https://allaboard.eu/embed/ use the live API and only accept a live key. While you build and test, load the same file from https://test.allaboard.eu/embed/ and give it a test key:
<script
src="https://test.allaboard.eu/embed/aa-journey-list.js"
type="module"></script>The Journey Cards and Rail Pass Cards make no API requests. Either script shows journeys and passes from either environment.
Styling
An embed takes its font and text color from the element it is placed in, so it reads as part of your page. Each embed has a theme attribute for a light or dark look.
To use your own brand colors, set two CSS variables on the embed or on any element around it. --aa-primary colors buttons, links and other accents, and --aa-secondary their hover state. Each takes any CSS color:
aa-journey-list {
--aa-primary: #0052cc;
--aa-secondary: #003d99;
}A color chosen for the light theme can be hard to read in the dark one. To give the dark theme its own colors, also set --aa-primary-dark and --aa-secondary-dark. The embed uses them whenever it shows the dark theme, including with theme="auto". Without them, the dark theme uses --aa-primary and --aa-secondary.
aa-journey-list {
--aa-primary: #0052cc;
--aa-secondary: #003d99;
--aa-primary-dark: #3b82f6;
--aa-secondary-dark: #60a5fa;
}In the dark theme the primary color sits behind white button text and also colors links on a dark background. Choose one that reads well in both places.
The older --rgb-primary and --rgb-secondary variables still work. They take the red, green and blue values of a color, such as 0 82 204. When both forms are set, the --aa- variables are used.
Cookies and tracking
What an embed stores and sends, for your cookie banner and privacy notice:
- A session cookie.
aa.sessionis set on your own domain and removed when the browser closes. It holds a random id that goes with every API request the embed makes, and lets us trace a problem you report. It is not used to follow visitors between sites. If you set thesessionIdattribute yourself, the cookie is not set. The Journey Cards and Rail Pass Cards don't set it either. - Usage statistics. The Rail Pass List and Rail Pass Modal tell All Aboard when they are shown, when a pass is selected and when a visitor goes on to the checkout, along with the address of the page they are on. No cookie is involved.
- Error reports. When something fails inside an embed, the error and the session id are reported to All Aboard so we can fix it.