Campaign Actions
How the Digia Engage SDK handles campaign button taps and URL navigation — and how to intercept them.
Last updated
await Digia.initialize({
apiKey: 'YOUR_ACCESS_KEY',
onAction: (action, context) => {
if (action.type === 'deep_link') {
// Parse and handle navigation within your app
const route = parseDeepLink(action.url); // your own helper
navigation.navigate(route.screen, route.params);
return true; // suppress SDK's Linking.openURL call
}
// Let the SDK handle all other action types
},
});type ActionContext = {
campaign_id: string;
campaign_key: string;
campaign_type: 'nudge' | 'guide' | 'inline' | 'survey';
source: {
kind: 'button' | 'card_tap' | 'pip_small_view' | 'auto_dismiss';
element_id?: string;
button_label?: string;
};
step_index?: number; // Guide campaigns only
step_total?: number; // Guide campaigns only
};import { defaultInAppBrowser } from '@digia-engage/core';
await Digia.initialize({
apiKey: 'YOUR_ACCESS_KEY',
linking: {
inAppBrowser: defaultInAppBrowser,
},
});{ open: (url: string) => Promise<void> }