测试对接
开始之前
Easily test with our SDK wizard
To successfully complete the tests in this document, you must:
Test Android SDK integration
The test consists of:
- Simulating an ad click and a conversion.
- Inspecting the conversion data of the install.
Simulate a conversion
Simulate a user clicking an ad and installing the app.
Step 1: Simulate ad click
Simulate an ad click via an attribution link. Structure the attribution link as follows:
https://app.appsflyer.com/<app_id>?pid=<media_source>
&advertising_id=<registered_device_gaid>
Where:
app_id
is your AppsFlyer app ID.pid
is the media source to which the install should be attributed.advertising_id
is the registered device's GAID.
The advertising_id
parameter is required to attribute via ID matching. If omitted, attribution will occur probabilistically.
For example, if your app ID is com.my.app
, the attribution link might look like this:
https://app.appsflyer.com/com.my.app?pid=devtest&c=test1
or, with GAID:
https://app.appsflyer.com/com.my.app?pid=devtest&c=test1&advertising_id=********-****-****-****-************
建议
Often, tests using attribution links are performed more than once. That's why it's recommended to use one of the attribution parameters to "version" your tests–it makes it easier to understand which link triggered which conversion.
In the above example, the value of
c
istest1
. In consecutive tests, increment the value ofc
totest2
,test3
, and so on.
Step 2: Install the app
Enable debug mode and install the app on a registered test device.
Step 3: Execute test
Proceed to inspect conversion data.
Inspect conversion data
After simulating a conversion, follow these steps to inspect the install's conversion data.
Step 1: Retrieve install UID
Once the app is installed, search the debug logs for conversions.appsflyer
Step 2: Inspect conversion data
Go to the conversion data test API and fill in the required fields:
app-id
: Your app IDdevice_id
: paste the value ofuid
from step 1.devkey
- Application's devkey. Learn here how to get it.
Then, click Try it! to execute the test.
Expected result
A 200 response containing the install's conversion data (truncated for readability):
{
...
"campaign": "test1",
...
"media_source": "devtest",
...
"af_status": "Non-organic"
...
}
注意
It might take up to 30 minutes for the install to appear in the dashboard.
Troubleshooting the Android SDK integration
Install always attributed to organic
场景
You are testing attribution using attribution links. You've implemented the SDK conversion listener but the log always shows that the install is organic. In addition, no non-organic install is recorded in the dashboard.
可能的原因
- 开发密钥不正确 - 如果指定不正确的开发密钥,则无法正确归因。
- The attribution link you are using is incorrect. See our guide on attribution links.
- Make sure that the device you are testing on is registered.
- manifest 中定义的渠道 (Channel) 不正确
Install not detected or attributed
场景
You are testing install attribution but the log doesn't show any data about the install such as type, first launch, etc.
可能的原因
- Make sure that the
start
andinit
methods are called in theApplication
class. - Make sure that the device you are testing on is registered.
I'm getting a 404 on install or event recording
场景
您正在测试应用内事件,以查看它们是否归因于正确的媒体渠道。但是,日志显示安装和发送应用内事件的响应 404。安装和应用内事件都不显示在控制面板中。
可能的原因
A 404 response indicates that the app ID is incorrect. Make sure that the app ID in the applicationId
parameter in the build.gradle
文件与控制面板中的文件相同。
Revenue is not recorded properly
场景
您正在测试具有收入的应用内事件。事件显示在控制面板中,但不记录收入
可能的原因
收入参数的格式不正确。不要给收入值设置任何格式。它不应包含逗号分隔符、货币符号或文本。例如,收入事件应类似于 1234.56。
The log shows "AppsFlyer's SDK cannot send any event without providing devkey" when I test in-app events
场景
您正在尝试在日志中查看应用内事件。触发事件时,日志仅显示"AppsFlyer 的 SDK 在未提供 DevKey 的情况下无法发送任何事件"。
可能的原因
You call the start
method without passing the dev key as a parameter. Pass the dev key to the method.
The log shows "not sending data yet, waiting for dev key" in the log when I test in-app events
场景
您正在尝试在日志中测试应用内事件。触发事件时,日志仅显示"尚未发送数据,正在等待 dev key"。
可能的原因
You call the init
and you pass the dev key as an empty string. Pass the dev key to the method.
I get response 400 when I test in-app events
场景
You are trying to test in-app events. When you trigger events you see an error 400 in the logs.
可能的原因
这可能表示 dev key 出现问题。检查 dev key 是否正确。此外,请确保 dev key 仅包含字母数字字符。
The log shows "warning: Google play services is missing"
场景
日志卡显示警告消息 "WARNING: Google Play Services is missing".
可能的原因
该应用程序缺少 Google Play Services Dependencies。这可能会阻止 SDK 收集 GAID, 这可能会导致难以归因问题。
Add the following dependencies to the app-level build.gradle
file:
implementation 'com.google.android.gms:play-services-base:<current-version>'
implementation 'com.google.android.gms:play-services-ads-identifier:<current-version>'
I get response 403 on install or event recording
场景
You are trying to test installs and other conversion events in the log. When you trigger these events, you see response 403 (forbidden) in the logs.
可能的原因
This might be because you have the Zero package, which does not include attribution data; only data on clicks and impressions. To start receiving attribution data, learn more about the different AppsFlyer packages, and update as needed. You can also contact our customer engagement team at [email protected] if you have questions about our packages.
Creating an Android debug app
可选
You can utilize Android Studio's build variants to configure an easy-to-use debug app for testing purposes.
All tests can be performed for both production and debug apps.
Step 1: Configure Gradle's debug
build type
In your app-level build.gradle
file, configure the debug
build type and set applicationIdSuffix
to the test app's name (in this case, .debug
).
android {
// ...
buildTypes {
// Prevents a signing error when building the production app
release {
signingConfig signingConfigs.debug
}
debug {
applicationIdSuffix ".debug"
}
}
}
Step 2: Add a new app to AppsFlyer
Use the resulting package name as the app ID when adding the app to the AppsFlyer dashboard, or ask a team member with dashboard access to add it.
For example, if you have an app with the package name com.your.app
and you use the Gradle configuration above, the test app's name will be com.your.app.debug
. Pass this name as the app ID when adding the app to AppsFlyer.
已更新 3 months ago