Getting Started

Deprecation Notice

This SDK is deprecated in favor of the Core and UI JS SDKs. See Migrating to the latest SDKs to use the latest Core and UI SDKs.

Support for the Legacy JS SDK ends on 28 February, 2021.

Migrating to the latest SDKs

  1. Update/add the script location/packages and initialize SDK:

  2. Check the new method signatures and update them.

    The Core and UI JS SDKs return Promises: replace callback passed as arguments, with then().

    For instance:

Browser compatibility

The SDK is compatible with the latest versions of:

  • Chrome (except in incognito mode)

  • Firefox

  • IE 11

Safari and Edge are supported up to the latest version where third party cookies are allowed. Please see the Safari and Edge documentation for more information.

Prerequisites

To initialize the ReachFive client:

  • You need a Domain URL and Client ID.

  • You must whitelist all available domains where the ReachFive SDK will be used.

    This is done in the Allowed Origins (CORS) field of your ReachFive console, in the Settings menu.

The ReachFive client detects the user locale from the browser. You can override this at initialization by providing a language as shown in the steps below.

...
const client = createClient({
    domain: DOMAIN,
    clientId: CLIENT_ID,
    // Optional parameter
    language: 'Here paste a language code' (1)
});
1 Here, you could put something like es for Spanish to override the browser language.
Currently supported languages
  • ar - العربية Arabic

  • de - Deutsch German

  • en - English

  • es - Español Spanish

  • fr - Français French

  • hu - Magyar Hungarian

  • it - Italiano Italian

  • jp - 日本 Japanese

  • ko - 한국인 Korean

  • nl - Nederlands Dutch

  • pt - Portuguese

  • ru - Ру́сский Russian

  • sk - Slovenský Slovak

  • zh-CN - People’s Republic of China Simplified Chinese

  • zh-Hans - Simplified Chinese

  • zh-Hant - Traditional Chinese

  • zh-HK - Hong Kong Traditional Chinese

  • zh-MO - Macao Traditional Chinese

  • zh-SG - Singapore Simplified Chinese

  • zh-TW - Taiwan Traditional Chinese

Installation

The SDK is served as a JavaScript asset from your ReachFive domain.

You must include it with a <script> in the <head> part of your page:

<script async src="https://{DOMAIN}/js/v1/identity.js?client_id={CLIENT_ID}"></script>

To override the client’s locale:

<script async src="https://{DOMAIN}/js/v1/{LANGUAGE}/identity.js?client_id={CLIENT_ID}"></script>

Don’t forget to replace the {DOMAIN}, {CLIENT_ID} and {LANGUAGE} parameters.

Include the following script at the end of the <body> element to prevent it from blocking the render of the rest of the page:

<script type="text/javascript">
  window.reach5=window.reach5||function(){(reach5.q=reach5.q||[]).push(arguments)};
  // Your code...
</script>

Now you can use the reach5 global variable to access the different methods of the legacy client.