Skip to main content

Dynamic Link

Dynamic links allow you to direct users to specific in-app content, track campaign performance, and handle platform-specific redirects (e.g., Play Store, iOS, desktop). With the AppTrove Andriod SDK, you can create dynamic links programmatically, embedding attribution and deep link parameters to enhance user acquisition and engagement.

Overview

Dynamic links provide a flexible way to route users based on their platform and context:

  • Purpose: Generate links for campaigns, deep linking to specific app content (e.g., NewMainActivity).
  • Use Case: Create a link like https://vistmarket.shop/78R2J2 that directs users to a product page with parameters (productid=jeans) and tracks campaign data (campaign=my_campaign).

Key Features:

  • Deep link to in-app destinations
  • Attribution parameters for tracking
  • Platform-specific redirects (Android, iOS, desktop)
  • Social media previews for sharing
  • Generated: https://vistmarket.shop/78R2J2?param1=value1&campaign=my_campaign
  • Redirects to: https://apptrove.com?utm_redirect=sdk_link or Play Store if app not installed

Configure Apptrove Panel

  1. Log in to the Apptrove Panel
  2. Go to Unilink Management > Create Template
  3. Setup Template
    • Save and note the template ID (Required for Dynamic Link)

Implementation

package com.example.myapp
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.trackier.sdk.DynamicLink;
import com.trackier.sdk.TrackierSDK;
import java.util.HashMap;
import java.util.Map;

public class DynamicLinkHelper {

private void createDynamicLink(Context context) {
// Build the dynamic link parameters
Map<String, String> sdkParams = new HashMap<>();
sdkParams.put("param1", "value1");
sdkParams.put("param2", "value2");

DynamicLink dynamicLink = new DynamicLink.Builder()
.setTemplateId("78R2J2") // Set the template ID for the link ( Get this id from Apptrove Pannel)
.setLink(Uri.parse("https://apptrove.com?utm_redirect=sdk_link")) // The base link
.setDomainUriPrefix("vistmarket.shop") // Domain prefix for the link
.setDeepLinkValue("NewMainActivity") // Deep link destination within the app
// Additional SDK parameters
.setSDKParameters(sdkParams)
// Attribution parameters for tracking
.setAttributionParameters(
"my_channel",
"my_campaign",
"at_invite",
"param1_value",
"param2_value",
"param3_value",
"param4_value",
"param5_value"
)
// Android-specific parameters
.setAndroidParameters(
new DynamicLink.AndroidParameters.Builder()
.setRedirectLink("https://play.google.com?id=com.trackier.vistmarket")
.build()
)
// iOS-specific parameters
.setIosParameters(
new DynamicLink.IosParameters.Builder()
.setRedirectLink("https://www.example.com/ios")
.build()
)
// Desktop-specific parameters
.setDesktopParameters(
new DynamicLink.DesktopParameters.Builder()
.setRedirectLink("https://www.example.com/desktop")
.build()
)
// Social media preview settings
.setSocialMetaTagParameters(
new DynamicLink.SocialMetaTagParameters.Builder()
.setTitle("New Offer: Buy 1 Get 2 Free")
.setDescription("New deal is live now.")
.setImageLink("https://bluetooth_speaker.jpg")
.build()
)
.build();

// Call the SDK to create the dynamic link
TrackierSDK.createDynamicLink(
dynamicLink,
dynamicLinkUrl -> {
// Log success messages
// If performing any additional tasks, use Coroutine to avoid ANR issues
Log.d("DynamicLinkSuccess", dynamicLink.toString());
},
errorMessage -> {
// Log error messages
// If performing any additional tasks, use Coroutine to avoid ANR issues

Log.d("DynamicLinkError", errorMessage);
}
);
}
}

Configuration Parameters

Basic Parameters

ParameterTypeDescriptionRequired
templateIdstringUnilink template ID from the Trackier panelYes
linkstringBase/fallback URL used in browsers and previewsYes
domainUriPrefixstringYour verified/branded dynamic link domainYes
deepLinkValuestringApp route/value to navigate after resolvingNo

Platform Parameters

Android Parameters (fallback when app not installed)

new DynamicLink.AndroidParameters.Builder()
.setRedirectLink("https://play.google.com/store/apps/details?id=com.example.app")
.build();
new DynamicLink.IosParameters.Builder()
.setRedirectLink("https://apps.apple.com/app/id123456789")
.build();

Desktop Parameters (browser fallback)

new DynamicLink.DesktopParameters.Builder()
.setRedirectLink("https://yourdomain.com/desktop")
.build();

Social Media Parameters (Open Graph)

new DynamicLink.SocialMetaTagParameters.Builder()
.setTitle("Your App Title")
.setDescription("Your app description for social sharing")
.setImageLink("https://example.com/share-image.jpg")
.build();

SDK Parameters (Custom Payload)

Map<String, String> sdkParams = new HashMap<>();
sdkParams.put("product_id", "123"); // Use IDs/refs; avoid PII
sdkParams.put("quantity", "2");

Attribution Parameters (Campaign Tracking)

.setAttributionParameters(
"social", // channel
"summer_sale", // campaign
"facebook", // mediaSource
"custom_param1", // p1
"custom_param2", // p2
"custom_param3", // p3
"custom_param4", // p4
"custom_param5" // p5
);