Reattribute from deep links
Adtrace supports re-engagement campaigns with deep links. When a user who already has your app installed opens a tracker URL with deep link content, call the Adtrace SDK so it can read new attribution data from the link and send it to the Adtrace backend.
Complete Set up standard deep linking first (manifest, tracker URL, read the Intent). Then add appWillOpenUrl wherever you handle incoming deep links.
Method signature
public static void appWillOpenUrl(Uri url, Context context)
| Parameter | Type | Description |
|---|---|---|
url | Uri | The deep link URI from the activity Intent (intent.getData()). |
context | Context | Your app context (for example getApplicationContext()). |
AdTrace.appWillOpenUrl(Uri) without Context is deprecated as of Android SDK v2+. Use AdTrace.appWillOpenUrl(Uri, Context) instead.
The SDK inspects the URI for new attribution information. If it finds data, it forwards it to Adtrace for reattribution. Use Get attribution information to read updated attribution in your app.
onCreate
Call appWillOpenUrl when the activity is created with a deep link:
- Java
- Kotlin
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri data = getIntent().getData();
AdTrace.appWillOpenUrl(data, getApplicationContext());
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val data: Uri? = intent.data
AdTrace.appWillOpenUrl(data, applicationContext)
}
onNewIntent
Call appWillOpenUrl when an existing activity receives a new deep link:
- Java
- Kotlin
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Uri data = intent.getData();
AdTrace.appWillOpenUrl(data, getApplicationContext());
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
val data: Uri? = intent.data
AdTrace.appWillOpenUrl(data, applicationContext)
}
WebBridge apps
If your app uses WebBridge, you can call AdTrace.appWillOpenUrl from the WebView JavaScript bridge when a deep link is opened in the web layer. See the WebBridge integration guide for setup details.