The Tenjin SDK can listen to CAS impression level revenue data and send revenue events to Tenjin. This integration will send revenue related for each ad impression served from CAS. Here are the steps to integrate:
- Add the latest version of CAS SDK to your app-level build.gradle file: https://github.com/cleveradssolutions/CAS-Android/wiki
<aside> 💡
Please ensure you have the latest CAS Android SDK installed.
</aside>
- Also add the 广告网络, which you will support (e.g. com.cleveradssolutions:google:22.2.0.2, etc.)
- Integrate CAS SDK in your app. Below is an example of CAS integration.
public class CASActivity extends Activity {
private TenjinSDK tenjinInstance;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cas);
// Initialize Tenjin
tenjinInstance = TenjinSDK.getInstance(this, "<Tenjin API 应用程序接口 Key>");
// Validate Integration
CAS.validateIntegration(this);
// Set Ads Settings
CAS.settings.setDebugMode(true);
CAS.settings.setTaggedAudience(Audience.NOT_CHILDREN);
// Initialize SDK
MediationManager adManager = CAS.buildManager()
.withManagerId("demo")
.withAdTypes(AdType.Banner, AdType.Interstitial)
.withTestAdMode(true)
.initialize(this);
adManager.setEnabled(AdType.Interstitial, true);
showInterstitial(adManager);
}
private void showInterstitial(MediationManager manager) {
// Create Ad content callback
AdCallback contentCallback = new AdPaidCallback() {
@Override
public void onAdRevenuePaid(@NonNull AdStatusHandler adStatusHandler) {
tenjinInstance.eventAdImpressionCAS(adStatusHandler);
}
// Other AdPaidCallback methods
};
manager.showInterstitial(this, contentCallback);
}
}
Here is an example impression level revenue data entry from CAS:
| Parameter | Required? | Example |
|---|---|---|
| network_name | 没有 | Network |
| ad_unit_id | 没有 | id-69082 |
| creative_id | 没有 | id-41203 |
| 收入 | 是 | 2 |
| revenue_precision | 没有 | floor |
| format | 没有 | 插播广告 |