Skip to content

Widget Guide

The widget is an interactive iframe widget that looks seamless on the parent page. You can also view a demo of the widget in action.

Quick Start

A minimal configuration of required fields to add the widget to your website is shown below. Simply add the following code to the host page.

html
<script
  async
  src="//assets.motorsportreg.com/gec/loader.js"
  data-api-key="your-key-here"
  data-widget-id="your-widget-id-here"
></script>

Configuration Options

The loader pass all data attributes to the widget during initialization.

src

Required

This URL is the location of the javascript for the widget. The correct src URLs for the hosted widget is as follows:

EnvironmentURL
Production//assets.motorsportreg.com/gec/loader.js

data-api-key

Required

The attribute must exist in the configuration to properly configure the widget. As the widget will make requests to the API server, it must sign every request with the key.

data-widget-id

Required

The attribute indicates ID of the widget.

data-api-url

Optional

Useful in debugging or when a development URL is needed. This URL is the endpoint used for GraphQL requests. The available URLs are as follows:

EnvironmentURL
Production//api-v2.motorsportreg.com/graphql

data-locales

Optional

The optional list of language codes. For example, data-locales="en-US, fr-CA".

data-countries

Optional

The optional list of the countries. Note: it’s not used in the API requests.

data-collections

Optional

The optional list of the collections to show. Note: it’s not used in the API requests.

data-tealium-logged-in

Optional

This attribute indicates if the current user is logged in or not. Please, be sure that the host page contains the Tealium integration in place.

data-tealium-hashed-email

This attribute can contain SHA256 hash of the confirmed email of the current user. Please, be sure that the host page contains the Tealium integration in place.

data-sentry-dsn

If the host page contains the Sentry integration, this attribute can contain the Data Source Name.

data-sentry-traces-sample-rate

Optional

The optional attribute which configures the sample rate for error events, in the range of 0.0 to 1.0. The default is 1.0 which means that 100% of error events are sent. If set to 0.1 only 10% of error events will be sent. Events are picked randomly.

data-newsletter-api-url

Optional

The optional attribute contains newsletter subscription API endpoint.

data-mount

Optional

It's an optional attribute that indicates the id of the placeholder element for the widget. Keep in mind that the browser will wait for the DOMContentLoaded event to occur before the rendering.

If the placeholder id attribute is not defined, then the loader immediately renders a widget right before the script tag.

data-debug

Optional

Any value of the attribute enables logging to the browser console.