Skip to content

Documentation

Cordova, React Native and the web

The same package on the other three platforms, and an honest note about which of them we have actually run.

What we have actually run

Capacitor is the one to trust. The SDK was built against it, it is what our first customer uses, and it is the one described in the quickstart.

Cordova, React Native and plain web are written and unit-tested but have not been run inside a real application of that kind. The platform layer for each is exercised through an injected fake, which proves the SDK does the right thing when a platform behaves as documented — and proves nothing about whether it behaves as documented.

We would rather tell you that than let you find out. If you are integrating on one of these and something is wrong, write to [email protected] and it will be fixed quickly — you will be the first, and that is worth something to us.

Cordova

Detected through the cordova global. Links arrive by two routes and both are handled: the handleOpenURL global, and the universalLinks plugin’s subscription if you have it installed.

If you already define handleOpenURL, keep it. The SDK chains onto yours rather than replacing it — taking it over would break your app to serve ourselves.

Cordova — identical to Capacitortypescript
import { QubeRoute } from '@quberoute/sdk'

const qr = await QubeRoute.init({ key: 'qr_live_YOUR_KEY' })
qr.onLink(link => routeTo(link.data.path))

React Native

React Native has no localStorage and no module registry we can reach without adding a dependency — and adding react-native as a peer dependency would make this package refuse to install in a Capacitor project. So React Native needs two things passed in: storage, and Linking.

React Native — pass in what we cannot reachtypescript
import AsyncStorage from '@react-native-async-storage/async-storage'
import { Linking } from 'react-native'
import { QubeRoute } from '@quberoute/sdk'

// The SDK reads Linking from this global rather than importing it.
;(globalThis as Record<string, unknown>).QubeRouteLinking = Linking

const qr = await QubeRoute.init({
  key: 'qr_live_YOUR_KEY',
  storage: {
    get: key => AsyncStorage.getItem(key),
    set: (key, value) => AsyncStorage.setItem(key, value),
    remove: key => AsyncStorage.removeItem(key),
  },
})

qr.onLink(link => navigation.navigate(link.data.screen as string))

Without the storage adapter the SDK falls back to memory, which works for one session and forgets everything on the next launch — so every launch looks like a first launch and the deferred lookup runs every time. Nothing breaks, but it is wasteful and the attribution will be wrong.

Plain web

On the web the current address is the link, so the SDK reads the page address at startup and there is no resume: a new link is a new page load. localStorage is used automatically.

Only the origin and path are sent — never the query string or the fragment. Our own links carry the alias in the path, and a page address on your site routinely carries an order id, an email or a session token in its query string, none of which is ours to receive.

A visit to a bare address with no path is treated as an ordinary launch and makes no request at all. There is no deferred case on the web, because there is no install: a first visit that is not a link produces nothing.

What is the same everywhere

  • the five lines, and the shape of link.data;
  • never crashing the host app, and never blocking startup;
  • the offline queue, and its hundred-event cap;
  • what is collected — the list on the privacy page is complete for every platform.

Ask the documentation

It answers from these pages only, and links what it used. If the answer is not here it says so rather than guessing — then email [email protected].

← All documentation