Skip to main content

App Links & Deep Linking

Ometria sends personalised emails with URLs that point to your website. Configure your app to open these URLs directly.

Prerequisites

You need an SSL-enabled Ometria tracking domain. Contact your Ometria representative if you don't have one.

1. Platform Setup

Configure Associated Domains (iOS)

Add your Ometria tracking domain to associatedDomains in your app.json:

{
"expo": {
"ios": {
"associatedDomains": ["applinks:your-tracking-domain.com"]
}
}
}

Configure Intent Filters (Android)

Add an intentFilters entry in your app.json:

{
"expo": {
"android": {
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "your-tracking-domain.com"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}

These configurations are applied automatically during npx expo prebuild.

2. Apple App Site Association

Create an apple-app-site-association file:

{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAM_ID.com.yourcompany.yourapp",
"paths": ["*"]
}
]
}
}

Replace TEAM_ID with your Apple Developer Team ID (found in your Apple Developer account under Membership) and com.yourcompany.yourapp with your app's bundle identifier.

The apple-app-site-association file must be:

  • Hosted at https://your-tracking-domain.com/.well-known/apple-app-site-association
  • Served with Content-Type: application/json
  • Accessible without redirects
  • Available over HTTPS

Send this file to your Ometria contact who will host it on your tracking domain.

Ometria email links are obfuscated tracking URLs. Convert them to original URLs using processUniversalLink:

import Ometria from 'react-native-ometria';
import { Linking } from 'react-native';

// Handle incoming links
const handleUrl = async ({ url }) => {
try {
// Convert Ometria tracking URL to original URL
const originalUrl = await Ometria.processUniversalLink(url);
handleDeepLink(originalUrl);
} catch (error) {
// Not an Ometria link, handle normally
handleDeepLink(url);
}
};

// Subscribe to incoming links
Linking.addEventListener('url', handleUrl);

// Check if app was opened via a link
const initialUrl = await Linking.getInitialURL();
if (initialUrl) {
handleUrl({ url: initialUrl });
}

function handleDeepLink(url) {
// Parse URL and navigate to appropriate screen
const path = new URL(url).pathname;

if (path.startsWith('/product/')) {
const productId = path.split('/')[2];
navigation.navigate('Product', { productId });
} else if (path.startsWith('/category/')) {
const categoryId = path.split('/')[2];
navigation.navigate('Category', { categoryId });
}
// ... handle other paths
}

4. Linking to App Screens

The handleDeepLink function in the example above is something you need to build in your app. It should map your website URLs to the corresponding app screens using your navigation library.

Here are some common URL-to-screen mappings as a starting point:

URL PatternApp Screen
/product/:idProduct detail
/category/:idCategory listing
/cartShopping cart
/accountUser profile
/orders/:idOrder detail

See Linking push notifications to app screens in the Ometria help centre for more guidance.

Track when a user opens a deep link from a notification:

Ometria.trackDeepLinkOpenedEvent('/profile', 'ProfileScreen');

See Handling Notification URLs for more details.