Skip to content

Latest commit

 

History

History
136 lines (106 loc) · 4.19 KB

File metadata and controls

136 lines (106 loc) · 4.19 KB

Dlink Aggregation Report-Ads-SDK Integration Guide

Introduction to Advertising Reporting SDK

Event reporting involves submitting business events generated by operations to the advertising platform, enabling the platform to deliver ads more accurately to targeted users. Currently, it supports TikTok, Facebook, Google, Snapchat, AppLovin, Moloco, and more.

Step 1: Obtaining the pixelCode and accessToken

Log in to the advertiser platform (such as TikTok) to obtain the pixelCode and accessToken.

Step 2: Obtaining the SDK

(1) Configure the Maven repository

    <repositories>
        <repository>
            <id>deeplink</id>
            <name>deeplink</name>
            <url>https://maven.deeplink.dev/repository/maven-releases/</url>
        </repository>
    </repositories>
    

(2) Configuring the Maven coordinates of an SDK in pom.xml

<dependency>
  <groupId>dev.deeplink.sdk</groupId>
  <artifactId>capi-sdk-java</artifactId>
  <version>2.5.12</version>
</dependency>

Step 3: Integration Example

Below is an example of using TikTok for reporting to the advertiser:

(1) Initial Configuration

TikTokContext ctx = new TikTokContext();
ctx.setAccessToken("accessToken");
ctx.setPixelId("pixelCode");

(2) Business reporting events. For a list of supported events, please refer to the detailed inventory.

List<PurchaseEvent> events = new ArrayList<>()
PurchaseEvent event = new PurchaseEvent();
event.setId(StrUtil.toString(nextId()));
long timestamp = MockUtil.getUTCTimestamp();
event.setEventId("OR" + timestamp);
event.setEventTime(timestamp);
event.setEventSourceUrl("https://www.example.com/product/1");
event.setActionSource(source);
event.setUser(
        new User()
                .setExternalId(Lists.newArrayList("ExternalId"))
                .setEmails(Lists.newArrayList("test@example.com"))
                .setPhones(Lists.newArrayList("167121545678"))
                .setClickId("E.C.P.CpMBrRv11UkS62NF3cM1waIJ5ZiPaI-zo7IIql_3rwg")
                .setCookieId("SZ23mvj3b1S1JaaRvQn575FVv")
                .setClientIpAddress("41.2.1.1")
                .setClientUserAgent("Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-G973U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/14.2 Chrome/87.0.4280.141 Mobile Safari/537.36")
);
event.setApp(
    new App()
    .setAppId("com.google.android.gm");
    .setPlatform(App.Platform.android);
    .setGaid("6a392871-5ee4-413a-8544-b624bda36064");
    .setModel("V2111");
    .setLocale("en-US");
    .setOsVersion("12");
    .setAppVersion("1.1.10")
);
event.setCustom(
        new Custom()
                .setContents(Lists.newArrayList(
                        new Custom.Content()
                                .setQuantity(1L)
                                .setProductId("product_id")
                                .setProductName("product_name")
                ))
                .setCurrency("usd")
                .setValue(12F)
);
Ad ad = new Ad();
ad.setCallback("ClickId");
ad.setAttributed(false);
ad.setIsRetargeting(false);
ad.setAdId(adsMatch.getAdId());
ad.setCampaignId(adsMatch.getCampaignId());
ad.setCreativeId(adsMatch.getAdsetId());
ad.setInstallReferrer(entity.getInstallReferrer());
event.setAd(ad);
events.add(event);
TrackResult result = Conversion.create(ctx).mixed(events);

Attachment List

List of Supported Events

Event Name Corresponding Entity
Add to Cart AddToCartEvent
Product Details ViewContentEvent
In-App Purchase PurchaseEvent
Sign Up CompleteRegistrationEvent
Checkout InitiateCheckoutEvent
Add to Wishlist AddToWishlistEvent
Search SearchEvent
Subscribe SubscribeEvent

Supported Advertising Channels

Channels Configured Entities
Facebook FacebookContext
TikTok TikTokContext
Google GoogleContext
Snap chat SnapContext
Applovin ApplovinContext
Moloco MolocoContext