광고 구매 어트리뷰션 이해
광고 구매 어트리뷰션은 사용자를 앱으로 유도한 특정 캠페인에 광고 구매을 연결할 수 있도록 도와줍니다. 이를 통해 캠페인 비용, 인앱 구매, 광고 구매을 한 곳에서 모두 표시하여 광고 실적을 명확하게 파악할 수 있습니다. 또한 이 기능을 사용하면 광고 구매 데이터를 광고 네트워크에 다시 전송하여 광고 실적을 개선할 수 있습니다.
핵심 포인트:
- 기능: 광고 구매 어트리뷰션은 모바일 앱 광고 구매을 앱 사용자를 생성한 마케팅 캠페인과 연결합니다. 이렇게 하면 각 캠페인에서 얻은 구매과 전체 광고 ROI에 미치는 영향을 확인할 수 있습니다.
- 데이터 소스: 이 데이터는 일반적으로 미디에이션 플랫폼에서 제공되며, 사용자 수준 또는 노출 수준일 수 있습니다. Singular는 이 어트리뷰션 데이터를 가져오는 다양한 방법을 지원합니다.
- 자세히 보기: 자세한 내용은 Singular 광고 구매 어트리뷰션에 대한 FAQ 및 문제 해결 문서를 확인하세요.
중요 참고 사항:
- 통화 코드: 세 글자로 구성된 ISO 4217 통화 코드(예: 미국 달러의 경우 'USD', 유로의 경우 'EUR', 인도 루피의 경우 'INR')를 사용하세요. 많은 중개 플랫폼이 "USD"를 사용하므로 사용 중인 플랫폼의 코드가 이와 일치하는지 확인하세요. 다른 통화를 사용하는 경우 그에 맞게 유효성 검사 코드를 업데이트하세요.
- 데이터 정확성: 매출 및 통화 데이터를 Singular로 전송하기 전에 항상 정확한지 확인하세요. 잘못된 데이터는 나중에 수정할 수 없으므로 정확한지 확인하는 것이 중요합니다.
광고 구매 어트리뷰션 구현하기
- SDK를 업데이트합니다: 최신 버전의 Singular SDK가 있는지 확인하세요.
- 코드 스니펫 추가: 미디에이션 플랫폼에 따라, Singular SDK 설정에 적합한 코드 스니펫을 추가하세요.
다음 단계를 따르면 광고 구매 어트리뷰션을 올바르게 설정하고 광고 데이터를 최대한 활용하는 데 도움이 됩니다.
파트너 참고 사항
- 이 기능은 애드몹 계정에서 활성화해야 합니다.
애드몹 지원을 참조하세요.
-
광고 형식('앱 열기', '배너', '전면 광고', '네이티브', '보상형' 등)을 로드할 때 광고에서 구매이 발생할 때마다 트리거되는 콜백 함수로 유료 이벤트 핸들러를 설정하세요. Google 모바일 광고 SDK는 노출 이벤트를 추적하고 광고에서 발생한 구매으로 이 핸들러를 호출합니다.
이렇게 하려면 광고 형식의'로드' 함수를 유료 이벤트 핸들러를 포함하도록 수정합니다. 이 콜백 내에서 광고 구매 데이터를 관리하고, 유효성을 검사하고, Singular.adRevenue 함수를 사용하여 Singular로 전송합니다.
예를 들어, '보상형 광고'가 성공적으로 로드되면 유료 이벤트 핸들러는 광고의 구매 정보(adValue)를 수신합니다. 이 함수에서 구매 데이터를 처리하여 Singular로 전송합니다.
자세한 내용은 AdMob 설명서를 확인하세요.
중요: AdMob SDK는 플랫폼에 따라 구매을 다르게 보고합니다. 예를 들어, 0.005달러의 광고 구매은 Unity 및 Android 플랫폼에서는 5000으로 반환되지만 iOS에서는 0.005달러로 반환됩니다. iOS의 경우 0.005를 Singular SDK로 직접 전송합니다. 다른 플랫폼에서는 광고 가치를 마이크로에서 달러로 변환한 후 Singular로 전송하세요.
SDK 구현을 위한 코드 베이스를 선택합니다:
작동 방식
- 구글 애드몹 모바일 광고 SDK(iOS)를 구현합니다: 시작 가이드를 참조하세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고 구매 이벤트를 처리하도록 setOnPaidEventListener를 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 못하도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 보내기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import Singular
private let adUnitID = "AD_UNIT_ID"
var rewardedAd: GADRewardedAd?
func loadRewardedAd() {
let request = GADRequest()
GADRewardedAd.load(withAdUnitID: adUnitID, request: request) { [weak self] ad, error in
guard let self = self else { return }
if let error = error {
print("Rewarded ad failed to load with error: \(error.localizedDescription)")
return
}
self.rewardedAd = ad
self.rewardedAd?.paidEventHandler = { adValue in
// Ensure valid revenue data
let revenue = adValue.value
let currency = adValue.currencyCode
// Validate the revenue and currency before sending to Singular
guard revenue > 0, let currency = currency, !currency.isEmpty else {
print("Invalid ad revenue data: revenue = \(revenue), currency = \(String(describing: currency))")
return
}
let data = SingularAdData(
adPlatform: "Admob",
currency: currency,
revenue: revenue
)
// Send Ad Revenue data to Singular
Singular.adRevenue(data: data)
// Log the data for debugging
print("Ad Revenue reported to Singular: \(data)")
}
}
}
작동 방식:
- 구글 애드몹 모바일 광고 SDK(iOS)를 구현합니다: 시작 가이드를 참조하세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고 구매 이벤트를 처리할 유료 이벤트 핸들러를 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 보내기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
#import <Singular/Singular.h>
static NSString *const adUnitID = @"AD_UNIT_ID";
// Initialize and load the rewarded ad
@interface YourClassName () <GADRewardedAdDelegate>
@property(nonatomic, strong) GADRewardedAd *rewardedAd;
@end
@implementation YourClassName
- (void)loadRewardedAd {
GADRequest *request = [[GADRequest alloc] init];
[GADRewardedAd loadWithAdUnitID:adUnitID
request:request
completionHandler:^(GADRewardedAd *ad, NSError *error) {
if (error) {
NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]);
return;
}
self.rewardedAd = ad;
self.rewardedAd.fullScreenContentDelegate = self;
self.rewardedAd.paidEventHandler = ^(GADAdValue *adValue) {
// Ensure valid revenue data
NSDecimalNumber *revenue = adValue.value;
NSString *currency = adValue.currencyCode;
if (revenue.doubleValue > 0 && currency.length > 0) {
SingularAdData *data = [[SingularAdData alloc] initWithAdPlatfrom:@"Admob"
currency:currency
revenue:revenue.doubleValue];
// Send Ad Revenue data to Singular
[Singular adRevenue:data];
// Log the data for debugging
NSLog(@"Ad Revenue reported to Singular: %@", data);
} else {
NSLog(@"Invalid ad revenue data: revenue = %@, currency = %@", revenue, currency);
}
};
}];
}
@end
작동 방식:
- 구글 애드몹 모바일 광고 SDK(안드로이드)를 구현합니다: 시작 가이드를 참조하세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고 구매 이벤트를 처리하도록 setOnPaidEventListener를 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 못하도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 보내기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.Singular
import com.singular.sdk.SingularAdData
private const val AD_UNIT_ID = "AD_UNIT_ID"
class AdManager(private val context: Context) {
private var rewardedAd: RewardedAd? = null
fun loadRewardedAd() {
val adRequest = AdRequest.Builder().build()
RewardedAd.load(context, AD_UNIT_ID, adRequest, object : RewardedAdLoadCallback() {
override fun onAdLoaded(ad: RewardedAd) {
rewardedAd = ad
rewardedAd?.fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdShowedFullScreenContent() {
Log.d("AdManager", "Rewarded ad displayed.")
}
override fun onAdFailedToShowFullScreenContent(adError: AdError) {
Log.d("AdManager", "Rewarded ad failed to show with error: ${adError.message}")
}
override fun onAdDismissedFullScreenContent() {
Log.d("AdManager", "Rewarded ad dismissed.")
}
}
rewardedAd?.setOnPaidEventListener { adValue: AdValue ->
// Ensure valid revenue data
val revenue = adValue.valueMicros / 1_000_000.0
val currency = adValue.currencyCode
if (revenue > 0 && !currency.isNullOrEmpty()) {
val data = SingularAdData(
"Admob",
currency,
revenue
)
// Send Ad Revenue data to Singular
Singular.adRevenue(data)
// Log the data for debugging
Log.d("AdManager", "Ad Revenue reported to Singular: $data")
} else {
Log.d("AdManager", "Invalid ad revenue data: revenue = $revenue, currency = $currency")
}
}
}
override fun onAdFailedToLoad(loadAdError: LoadAdError) {
Log.d("AdManager", "Rewarded ad failed to load with error: ${loadAdError.message}")
}
})
}
}
작동 방식:
- 구글 애드몹 모바일 광고 SDK(안드로이드)를 구현합니다: 시작 가이드를 참조하세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고 구매 이벤트를 처리하도록 setOnPaidEventListener를 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 못하도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 보내기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.Singular;
import com.singular.sdk.SingularAdData;
// Define constants for better maintainability
private static final String AD_UNIT_ID = "AD_UNIT_ID";
public class AdManager {
private RewardedAd rewardedAd;
private Context context;
public AdManager(Context context) {
this.context = context;
}
public void loadRewardedAd() {
AdRequest adRequest = new AdRequest.Builder().build();
RewardedAd.load(context, AD_UNIT_ID, adRequest, new RewardedAdLoadCallback() {
@Override
public void onAdLoaded(RewardedAd ad) {
rewardedAd = ad;
rewardedAd.setFullScreenContentCallback(new FullScreenContentCallback() {
@Override
public void onAdShowedFullScreenContent() {
Log.d("AdManager", "Rewarded ad displayed.");
}
@Override
public void onAdFailedToShowFullScreenContent(AdError adError) {
Log.d("AdManager", "Rewarded ad failed to show with error: " + adError.getMessage());
}
@Override
public void onAdDismissedFullScreenContent() {
Log.d("AdManager", "Rewarded ad dismissed.");
}
});
rewardedAd.setOnPaidEventListener(new OnPaidEventListener() {
@Override
public void onPaidEvent(AdValue adValue) {
double revenue = adValue.getValueMicros() / 1_000_000.0;
String currency = adValue.getCurrencyCode();
// Validate the revenue value
if (revenue <= 0 || currency == null || currency.isEmpty()) {
Log.d("AdManager", "Invalid ad revenue data: revenue = " + revenue + ", currency = " + currency);
return;
}
SingularAdData data = new SingularAdData(
"Admob",
currency,
revenue
);
// Send Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
Log.d("AdManager", "Ad Revenue reported to Singular: " + data);
}
});
}
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
Log.d("AdManager", "Rewarded ad failed to load with error: " + loadAdError.getMessage());
}
});
}
}
작동 방식:
- 구글 애드몹 모바일 광고 SDK(Flutter)를 구현합니다: 시작 가이드를 참조하세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고 구매 이벤트를 처리하기 위해 onPaidEvent 콜백을 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 보내기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import 'package:singular_flutter_sdk/singular_flutter_sdk.dart';
const String adUnitId = 'YOUR_AD_UNIT_ID';
class AdManager {
RewardedAd? _rewardedAd;
void loadRewardedAd() {
RewardedAd.load(
adUnitId: adUnitId,
request: AdRequest(),
rewardedAdLoadCallback: RewardedAdLoadCallback(
onAdLoaded: (RewardedAd ad) {
_rewardedAd = ad;
_rewardedAd?.fullScreenContentCallback = FullScreenContentCallback(
onAdShowedFullScreenContent: () {
print('Rewarded ad displayed.');
},
onAdFailedToShowFullScreenContent: (AdError adError) {
print('Rewarded ad failed to show with error: ${adError.message}');
},
onAdDismissedFullScreenContent: () {
print('Rewarded ad dismissed.');
_rewardedAd = null; // Clear the ad when it is dismissed
},
);
_rewardedAd?.onPaidEvent = (AdValue adValue) {
double revenue = adValue.valueMicros / 1_000_000.0; // Convert from micros to dollars
String? currency = adValue.currencyCode;
// Validate the revenue and currency before sending to Singular
if (revenue > 0 && currency != null && currency.isNotEmpty) {
final data = {
'adPlatform': 'Admob',
'currency': currency,
'revenue': revenue,
};
// Send Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
print('Ad Revenue reported to Singular: $data');
} else {
print('Invalid ad revenue data: revenue = $revenue, currency = $currency');
}
};
},
onAdFailedToLoad: (LoadAdError loadAdError) {
print('Rewarded ad failed to load with error: ${loadAdError.message}');
},
),
);
}
}
작동 방식:
- Cordova는 Google에서 공식적으로 지원하지 않으며 타사 Cordova 플러그인을 사용해야 합니다. 애드몹 플러스 코드바는 코드바 플러그인 애드몹 프리의 후속 버전으로, 보다 깔끔한 API와 최신 도구로 빌드를 제공합니다. 이 플러그인은 Singular에서 지원되지 않습니다. 시작 가이드를 참조하세요.
- 애드몹 초기화: 광고 단위 ID로 광고 형식에 대한 인스턴스를 생성합니다. 'ca-app-pub-xxx/yyy'를 실제 광고 단위 ID로 바꿔야 합니다.
- 이벤트 처리: 유료 이벤트 콜백을 트리거합니다: 이 이벤트는 구매 및 통화 코드를 제공합니다. 이 값의 유효성을 검사하고 구매을 마이크로에서 달러로 변환합니다. 이 데이터를 Singular로 보냅니다. 필요한 경우 로깅을 통해 "로드", "표시", "해제", "오류" 라이프사이클 이벤트를 처리합니다.
- 데이터 유효성 검사: 데이터를 Singular로 보내기 전에 구매이 0보다 크고 통화 코드가 있는지 확인합니다.
- Singular 연동: SingularAdData 객체를 사용하여 데이터를 준비하고 adRevenue를 호출하여 데이터를 Singular로 전송합니다.
document.addEventListener('deviceready', async () => {
const admob = window.cordova.plugins.AdMobPlus;
// Initialize RewardedAd
const rewarded = admob.RewardedAd.create({
adUnitId: 'ca-app-pub-xxx/yyy', // Replace with your ad unit ID
// Optional configurations
isTesting: true, // Set to false when going live
});
// Handle the 'paid' event to get revenue details
rewarded.on('paid', (event) => {
const { value, currencyCode } = event;
// Validate the revenue and currency data
if (value > 0 && currencyCode) {
const revenueAmount = value / 1_000_000.0; // Convert from micros to dollars
// Prepare data for Singular
const adData = new cordova.plugins.SingularCordovaSdk.SingularAdData(
'Admob', // Mediation platform
currencyCode, // Currency code
revenueAmount // Revenue amount
);
// Send Ad Revenue data to Singular
cordova.plugins.SingularCordovaSdk.adRevenue(adData);
// Log the data for debugging
console.log('Ad Revenue reported to Singular:', {
adPlatform: 'Admob',
currency: currencyCode,
revenue: revenueAmount
});
} else {
console.error('Invalid ad revenue data:', { value, currencyCode });
}
});
// Handle ad load and show events
rewarded.on('load', async () => {
console.log('Rewarded ad loaded.');
// Load the next ad as soon as the current one is dismissed
await rewarded.load();
});
rewarded.on('show', () => {
console.log('Rewarded ad shown.');
});
rewarded.on('dismiss', async () => {
console.log('Rewarded ad dismissed.');
// Load a new ad for future use
await rewarded.load();
});
rewarded.on('error', (error) => {
console.error('Error with rewarded ad:', error);
});
// Load and show the rewarded ad
await rewarded.load();
await rewarded.show();
}, false);
작동 방식
- 리액트 네이티브 구글 모바일 광고 패키지를 구현합니다: 시작 가이드를 참조하세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고 구매 이벤트를 처리하도록 onAdEvent를 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 보내기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import { Singular } from 'singular-react-native';
const adUnitID = 'AD_UNIT_ID';
const loadRewardedAd = () => {
// Create a RewardedAd instance with the provided adUnitID
const rewardedAd = RewardedAd.createForAdRequest(adUnitID);
// Set up event listener for ad events
rewardedAd.onAdEvent((type, error, data) => {
if (type === AdEventType.LOADED) {
console.log('Rewarded ad loaded');
} else if (type === AdEventType.ERROR) {
console.error('Rewarded ad failed to load', error);
} else if (type === AdEventType.PAID_EVENT) {
// Extract value and currencyCode from event data
const { value, currencyCode } = data;
// Validate the revenue and currency before sending to Singular
if (value > 0 && currencyCode) {
const revenue = value / 1_000_000.0; // Convert from micros to dollars
const adRevenueData = {
'Admob',
currency: currencyCode,
revenue,
};
// Send Ad Revenue data to Singular
Singular.adRevenue(adRevenueData);
// Log the data for debugging
console.log('Ad Revenue reported to Singular:', adRevenueData);
} else {
console.error('Invalid ad revenue data:', { value, currencyCode });
}
}
});
// Load the rewarded ad
rewardedAd.load();
};
useEffect(() => {
// Load the rewarded ad when the component mounts
loadRewardedAd();
}, []);
작동 방식:
- 구글 애드몹 모바일 광고 SDK(유니티)를 구현합니다: 시작 가이드를 참조하세요.
- 여기에서Google AdMob 문서에 설명된 보상형 광고 이벤트에 대해 알아보세요.
- 애드몹 연동: AdMob에서 광고를 로드하고 광고에서 구매이 발생한 시점에 대한 OnAdPaid 콜백을 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 못하도록 합니다.
- 통화 유효성 검사: 데이터를 Singular로 전송하기 전에 통화가 0이거나 비어 있지 않은지 확인합니다.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
using Singular;
private void RegisterEventHandlers(RewardedAd ad)
{
// Raised when the ad is estimated to have earned money.
ad.OnAdPaid += (AdValue adValue) =>
{
// Validate and ensure revenue data is within an expected range
float revenue = adValue.Value / 1_000_000f; // Convert micros to dollars
string currency = adValue.CurrencyCode;
// Check if revenue is positive and currency is valid
if (revenue > 0 && !string.IsNullOrEmpty(currency))
{
// Construct and send the Singular AdMon Event
SingularAdData data = new SingularAdData(
"Admob",
currency,
revenue
);
SingularSDK.AdRevenue(data);
// Log the revenue data for debugging purposes
Debug.Log($"Ad Revenue reported to Singular: {data}");
}
else
{
Debug.LogError($"Invalid ad revenue data: revenue = {revenue}, currency = {currency}");
}
};
}
파트너 노트
- 앱러빈 노출 수준 사용자 구매 API를 사용하여 노출 수준 광고 구매 데이터를 공유합니다.
SDK 구현을 위한 코드 베이스를 선택합니다:
작동 방식
- AppLovin 노출 수준 사용자 구매 API(iOS)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: AppLovin MAX에서 보상형 광고를 로드하고 didReceive 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 확인을 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import Singular
func didReceive(_ message: ALCMessage) {
if "max_revenue_events" == message.topic {
// Safely unwrap values from the message data
guard
let revenueValue = message.data["revenue"] as? Double,
revenueValue > 0
else {
print("Failed to parse valid revenue value from message data or revenue is not greater than 0")
return
}
let data = SingularAdData(
adPlatform: "AppLovin",
currency: "USD", // Update this if a different currency is needed
revenue: revenueValue
)
// Send the revenue data to Singular
Singular.adRevenue(data)
}
}
작동 방식:
- 앱러빈 노출 수준 사용자 구매 API(iOS)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: AppLovin MAX에서 보상형 광고를 로드하고 didReceive 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 확인을 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
#import <Singular/Singular.h>
- (void)didReceive:(ALCMessage *)message {
if ([@"max_revenue_events" isEqualToString:message.topic]) {
NSDictionary *data = message.data;
NSNumber *revenueNumber = data[@"revenue"];
double revenueValue = [revenueNumber doubleValue];
if (revenueValue > 0) {
SingularAdData *adData = [[SingularAdData alloc] initWithAdPlatfrom:@"AppLovin"
currency:@"USD"
revenue:revenueValue];
// Send the revenue data to Singular
[Singular adRevenue:adData];
} else {
NSLog(@"Failed to parse valid revenue value from message data or revenue is not greater than 0");
}
}
}
작동 방식:
- 앱러빈 노출 수준 사용자 구매 API(Android)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: AppLovin MAX에서 보상형 광고를 로드하고 onMessageReceived 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.*
override fun onMessageReceived(message: AppLovinCommunicatorMessage) {
// In the case that you are subscribed to multiple topics, check for the desired one
if ("max_revenue_events" == message.topic) {
val adData: Bundle? = message.messageData
// Safely access and validate revenue value
val revenueValue = adData?.getDouble("revenue", 0.0) ?: 0.0
if (revenueValue > 0) {
val data = SingularAdData(
adPlatform = "AppLovin",
currency = "USD",
revenue = revenueValue
)
Singular.adRevenue(data)
} else {
Log.e("AppLovinRevenue", "Failed to parse valid revenue value from message data or revenue is not greater than 0")
}
}
}
작동 방식:
- 앱러빈 노출 수준 사용자 구매 API(Android)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: AppLovin MAX에서 보상형 광고를 로드하고 onMessageReceived 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.*;
@Override
public void onMessageReceived(AppLovinCommunicatorMessage message) {
// In the case that you are subscribed to multiple topics, check for the desired one
if ("max_revenue_events".equals(message.getTopic())) {
Bundle adData = message.getMessageData();
// Safely access and validate revenue value
double revenueValue = (adData != null) ? adData.getDouble("revenue", 0.0) : 0.0;
if (revenueValue > 0) {
SingularAdData data = new SingularAdData(
"AppLovin",
"USD",
revenueValue
);
Singular.adRevenue(data);
} else {
Log.e("AppLovinRevenue", "Failed to parse valid revenue value from message data or revenue is not greater than 0");
}
}
}
작동 방식:
- 앱러빈 노출 수준 사용자 구매 API(Flutter)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: onAdRevenuePaidCallback에 대한 광고 리스너를 설정하고 광고 구매 이벤트를 처리하기 위해 광고 데이터를 handleAdRevenuePaid 함수에 전달합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 못하도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import 'package:singular_flutter_sdk/singular.Flutter';
@override
void initState() {
super.initState();
// Set up ad listeners
AppLovinMAX.setInterstitialListener(InterstitialListener(
onAdRevenuePaidCallback: (ad) {
_handleAdRevenuePaid(ad);
},
));
AppLovinMAX.setRewardedAdListener(RewardedAdListener(
onAdRevenuePaidCallback: (ad) {
_handleAdRevenuePaid(ad);
},
));
AppLovinMAX.setBannerListener(AdViewAdListener(
onAdRevenuePaidCallback: (ad) {
_handleAdRevenuePaid(ad);
},
));
AppLovinMAX.setMRecListener(AdViewAdListener(
onAdRevenuePaidCallback: (ad) {
_handleAdRevenuePaid(ad);
},
));
}
void _handleAdRevenuePaid(Ad ad) {
final double revenueValue = ad.revenue ?? 0.0;
final String currency = ad.currency ?? 'USD'; // Default to 'USD' if currency is not available
if (revenue > 0) {
final SingularAdData adData = SingularAdData(
adPlatform: "AppLovin",
currency: currency,
revenue: revenueValue,
);
Singular.adRevenue(adData);
_logger.i('Sent ad revenue to Singular: $revenueValue $currency');
} else {
_logger.e('Failed to parse valid revenue value from ad revenue data or revenue is not greater than 0');
}
}
지원되지 않습니다:
앱러빈의 Cordova SDK는 기본적으로 adInfo 객체를 통한 광고 구매 정보 캡처를 지원하지 않습니다. Cordova SDK는 일반적으로 Android 및 iOS용 기본 SDK에 비해 고급 기능이 더 제한적입니다.
고급 광고 구매 추적의 경우 기본 AppLovin SDK와 직접 연동하거나 사용자 지정 플러그인을 사용하여 Cordova와 기본 SDK 간의 기능을 연결해야 할 수 있습니다. 광고 구매 데이터가 필요한 경우, 최신 정보를 얻기 위해 AppLovin 지원팀에 문의하거나 이 데이터를 캡처할 수 있는 다른 방법을 찾아보세요.
작동 방식
- 앱러빈 노출 수준 사용자 구매 API(리액트 네이티브)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: 앱러빈 MAX에서 보상형 광고를 로드하고 모든 광고 라이프사이클 콜백에서 구매 금액을 검색합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 "USD"로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import Singular from 'singular-react-native';
// Function to handle ad revenue
const handleAdRevenue = (adInfo) => {
const revenue = adInfo.revenue;
if (revenue > 0) {
const adData = {
adPlatform: "AppLovin",
currency: "USD", // AppLovin typically reports revenue in USD
revenue: revenue,
};
// Send ad revenue data to Singular
Singular.adRevenue(adData);
} else {
console.error("Failed to parse valid revenue value from ad info or revenue is not greater than 0");
}
};
// Set up listeners for various ad types
InterstitialAd.addAdRevenuePaidListener(handleAdRevenue);
RewardedAd.addAdRevenuePaidListener(handleAdRevenue);
BannerAd.addAdRevenuePaidListener(handleAdRevenue);
MRecAd.addAdRevenuePaidListener(handleAdRevenue);
AppOpenAd.addAdRevenuePaidListener(handleAdRevenue);
작동 방식:
- 앱러빈 노출 수준 사용자 구매 API(유니티)를 사용합니다: 시작 가이드를 참조하세요.
- 앱러빈 연동: AppLovin MAX에서 보상형 광고를 로드하고 모든 광고 라이프사이클 콜백에서 구매 금액을 검색합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 "USD"로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
using Singular;
public class AdRevenueHandler : MonoBehaviour
{
void Start()
{
// Attach callbacks based on the ad format(s) you are using
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
MaxSdkCallbacks.Banner.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
MaxSdkCallbacks.MRec.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
}
private void OnAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
double revenue = adInfo.Revenue;
if (revenue > 0)
{
// Create a SingularAdData object with relevant information
SingularAdData adData = new SingularAdData(
"Applovin",
"USD",
revenue);
// Send ad revenue data to Singular
SingularSDK.AdRevenue(adData);
}
else
{
Debug.LogError("Failed to parse valid revenue value from ad info or revenue is not greater than 0");
}
}
void OnDestroy()
{
// Detach callbacks to prevent memory leaks
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent -= OnAdRevenuePaidEvent;
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent -= OnAdRevenuePaidEvent;
MaxSdkCallbacks.Banner.OnAdRevenuePaidEvent -= OnAdRevenuePaidEvent;
MaxSdkCallbacks.MRec.OnAdRevenuePaidEvent -= OnAdRevenuePaidEvent;
}
}
파트너 노트
- ILR(노출 수준 구매) SDK API는 아이언소스 SDK를 사용하여 아이언소스 광고 및 기타 미디에이티드 네트워크에 대한 노출 수준 데이터를 제공합니다.developers.is.com]에서 자세히 알아보기
- 아이언소스에서 ARM SDK 포스트백 플래그가 켜져 있는지 확인합니다.
SDK 구현을 위한 코드 베이스를 선택합니다:
작동 방식
- 아이언소스 SDK를 사용하여 노출 수준 사용자 구매(iOS)을 얻습니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 impressionDataDidSucceed 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 확인을 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import Singular
class IronSourceRewardedAdViewController: UIViewController {
func impressionDataDidSucceed(impressionData: ISImpressionData?) {
logCallback(#function)
// Ensure impressionData is not nil
guard let impressionData = impressionData else {
print("No impression data available.")
return
}
// Ensure revenue value is valid
let revenue = impressionData.revenue
guard revenue > 0 else {
print("Invalid revenue value: \(revenue)")
return
}
// Create SingularAdData object with appropriate values
let data = SingularAdData(
adPlatform: "IronSource",
currency: "USD",
revenue: revenue
)
// Send the Ad Revenue data to Singular
Singular.adRevenue(data)
// Log the data for debugging
print("Ad Revenue reported to Singular: AdPlatform: \(data.adPlatform), Currency: \(data.currency), Revenue: \(data.revenue)")
}
private func logCallback(_ functionName: String) {
// Implement logging if needed
print("Function called: \(functionName)")
}
}
작동 방식:
- ironSource SDK를 사용하여 노출 수준 사용자 구매(iOS)을 가져옵니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 impressionDataDidSucceed 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 확인을 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
#import <Singular/Singular.h>
@implementation IronSourceRewardedAdViewController
- (void)impressionDataDidSucceed:(ISImpressionData *)impressionData {
[self logCallback:NSStringFromSelector(_cmd)];
// Ensure impressionData is not nil
if (!impressionData) {
NSLog(@"No impression data available.");
return;
}
// Ensure revenue value is valid
double revenue = impressionData.revenue;
if (revenue <= 0) {
NSLog(@"Invalid revenue value: %f", revenue);
return;
}
// Create SingularAdData object with appropriate values
SingularAdData *data = [[SingularAdData alloc] initWithAdPlatfrom:@"IronSource"
currency:@"USD"
revenue:revenue];
// Send the Ad Revenue data to Singular
[Singular adRevenue:data];
// Log the data for debugging
NSLog(@"Ad Revenue reported to Singular: AdPlatform: %@, Currency: %@, Revenue: %f",
data.adPlatform, data.currency, data.revenue);
}
- (void)logCallback:(NSString *)functionName {
// Implement logging if needed
NSLog(@"Function called: %@", functionName);
}
@end
작동 방식:
- ironSource SDK를 사용하여 노출 수준 사용자 구매(Android)을 가져옵니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 onImpressionDataSuccess 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.Singular
// Method called when impression data is successfully received
fun onImpressionDataSuccess(impressionData: ISImpressionData?) {
// Ensure impressionData is not null
if (impressionData == null) {
Log.d("IronSource", "No impression data available.")
return
}
// Ensure revenue value is valid
val revenue = impressionData.revenue.toDouble()
if (revenue <= 0) {
Log.w("IronSource", "Invalid revenue value: $revenue")
return
}
// Create SingularAdData object with required fields
val data = SingularAdData(
adPlatform = "IronSource",
currency = "USD",
revenue = revenue
)
// Send the Ad Revenue data to Singular
Singular.adRevenue(data)
// Log the data for debugging
Log.i("IronSource", "Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}")
}
작동 방식:
- ironSource SDK를 사용하여 노출 수준 사용자 구매(Android)을 가져옵니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 onImpressionDataSuccess 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.Singular;
import com.singular.sdk.SingularAdData;
public class IronSourceAdManager {
// Method called when impression data is successfully received
public void onImpressionDataSuccess(ISImpressionData impressionData) {
// Ensure impressionData is not null
if (impressionData == null) {
Log.d("IronSource", "No impression data available.");
return;
}
// Ensure revenue value is valid
double revenue = impressionData.getRevenue().doubleValue();
if (revenue <= 0) {
Log.w("IronSource", "Invalid revenue value: " + revenue);
return;
}
// Create SingularAdData object with required fields
SingularAdData data = new SingularAdData(
"IronSource", // adPlatform
"USD", // currency
revenue // revenue
);
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
Log.i("IronSource", "Ad Revenue reported to Singular: AdPlatform: " + data.getAdPlatform() +
", Currency: " + data.getCurrency() +
", Revenue: " + data.getRevenue());
}
}
작동 방식:
- 아이언소스 플러터 플러그인을 사용하여 노출 수준 사용자 구매을 얻습니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 onImpressionDataSuccess 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import 'package:singular_flutter_sdk/singular.Flutter';
// Method called when impression data is successfully received
void onImpressionDataSuccess(ISImpressionData? impressionData) {
// Ensure impressionData is not null
if (impressionData == null) {
print("No impression data available.");
return;
}
// Ensure revenue value is valid
final revenue = impressionData.revenue.toDouble();
if (revenue <= 0) {
print("Invalid revenue value: $revenue");
return;
}
// Create SingularAdData object with required fields
final data = SingularAdData(
adPlatform: "IronSource",
currency: "USD",
revenue: revenue,
);
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
if (kDebugMode) {
print("Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}");
}
}
지원되지 않음:
아이언소스는 기본적으로 코르도바 프레임워크에서 광고 구매 캡처를 지원하지 않습니다.
고급 광고 구매 추적을 위해서는 기본 ironSource의 SDK와 직접 연동하거나 사용자 지정 플러그인을 사용하여 Cordova와 기본 SDK 간의 기능을 연결해야 할 수 있습니다. 광고 구매 데이터가 필요한 경우, 아이언소스 지원팀에 문의하여 최신 정보를 얻거나 이 데이터를 캡처할 수 있는 다른 방법을 찾아보세요.
작동 방식
- 아이언소스 리액트 네이티브 플러그인을 사용하여 노출 수준 사용자 구매을 얻습니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 onImpressionDataSuccess 리스너를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import { Singular } from 'singular-react-native';
const { IronSourceModule } = NativeModules;
const ironSourceEventEmitter = new NativeEventEmitter(IronSourceModule);
const AD_PLATFORM = 'IronSource';
const CURRENCY = 'USD'; // Assuming USD, adjust if necessary
ironSourceEventEmitter.addListener('onImpressionDataSuccess', (impressionData) => {
if (!impressionData) {
console.log('No impression data available.');
return;
}
const revenue = impressionData.revenue;
// Validate the revenue to ensure it is within the expected range
if (revenue <= 0) {
console.warn(`Invalid revenue value: ${revenue}`);
return;
}
// Create SingularAdData object with valid values
const data = {
adPlatform: AD_PLATFORM,
currency: CURRENCY,
revenue: revenue,
};
// Send the revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging purposes
console.log(`Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}`);
});
작동 방식
- 아이언소스 유니티 플러그인을 사용하여 노출 수준 사용자 구매을 가져옵니다: 시작 가이드를 참조하세요.
- 아이언소스 연동: 아이언소스에서 보상형 광고를 로드하고 ImpressionDataReadyEvent 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다.
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
using Singular;
public class IronSourceRewardedAdViewController : MonoBehaviour
{
void Start()
{
// Ensure the listener is added before initializing the SDK
IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
// Initialize the IronSource SDK here if not already done
// IronSource.Agent.init("YOUR_IRONSOURCE_APP_KEY");
}
private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData)
{
if (impressionData != null)
{
// Ensure revenue value is valid
double? revenue = impressionData.revenue;
if (revenue.HasValue && revenue.Value > 0)
{
// Create SingularAdData object with appropriate values
SingularAdData adData = new SingularAdData(
"IronSource",
"USD",
revenue.Value
);
// Send the Ad Revenue data to Singular
SingularSDK.AdRevenue(adData);
// Log the data for debugging
Debug.Log($"Ad Revenue reported to Singular: AdPlatform: {adData.AdPlatform}, Currency: {adData.Currency}, Revenue: {adData.Revenue}");
}
else
{
Debug.LogError($"Invalid revenue value: {revenue}");
}
}
else
{
Debug.LogError("Impression data is null.");
}
}
void OnDestroy()
{
// Detach the callback to prevent memory leaks
IronSourceEvents.onImpressionDataReadyEvent -= ImpressionDataReadyEvent;
}
}
파트너 참고 사항
- 인상 델리게이트설정
- 트레이드플러스광고 노출 콜백에 Singular 추가하기
SDK 구현을 위한 코드 베이스를 선택합니다:
작동 방식
- 트레이드플러스 연동: 트레이드플러스에서 보상형 광고를 로드하고 트레이드플러스광고 노출 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import Singular
// Set up the delegate
TradPlus.sharedInstance().impressionDelegate = self
// Delegate method for handling ad impressions
func tradPlusAdImpression(_ adInfo: [String: Any]) {
let currency = "USD" // Assuming USD, adjust if necessary
// Ensure adInfo contains the necessary key and its value is valid
if let ecpmValue = adInfo["ecpm"] as? NSNumber {
let revenue = ecpmValue.doubleValue / 1000.0
// Validate the revenue value
guard revenue > 0 else {
print("Ad Revenue value out of expected range: \(revenue)")
return
}
// Create SingularAdData object with required fields
let data = SingularAdData(
adPlatform: "TradPlus",
currency: currency,
revenue: revenue
)
// Send the Ad Revenue data to Singular
Singular.adRevenue(data)
print("Ad Revenue reported to Singular: \(data)")
} else {
// Log the issue for debugging
print("No eCPM data available in adInfo")
}
}
작동 방식
- 트레이드플러스 연동: 트레이드플러스에서 보상형 광고를 로드하고 트레이드플러스광고 노출 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
#import <Singular/Singular.h>
// Set up the delegate
TradPlus.sharedInstance.impressionDelegate = self;
// Delegate method for handling ad impressions
- (void)tradPlusAdImpression:(NSDictionary<NSString *, id> *)adInfo {
NSString *currency = @"USD"; // Assuming USD, adjust if necessary
// Ensure adInfo contains the necessary key and its value is valid
NSNumber *ecpmValue = adInfo[@"ecpm"];
if (ecpmValue) {
double revenue = [ecpmValue doubleValue] / 1000.0;
// Validate the revenue value
if (revenue <= 0) {
NSLog(@"Ad Revenue value out of expected range: %f", revenue);
return;
}
// Create SingularAdData object with required fields
SingularAdData *data = [[SingularAdData alloc] initWithAdPlatfrom:@"TradPlus"
currency:currency
revenue:revenue];
// Send the Ad Revenue data to Singular
[Singular adRevenue:data];
NSLog(@"Ad Revenue reported to Singular: AdPlatform: %@, Currency: %@, Revenue: %f", data.adPlatform, data.currency, data.revenue);
} else {
// Log the issue for debugging
NSLog(@"No eCPM data available in adInfo");
}
}
작동 방식
- 트레이드플러스 연동: 트레이드플러스에서 보상형 광고를 로드하고 onImpressionSuccess 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.Singular
import com.singular.sdk.SingularAdData
// Set the global impression listener for TradPlus
TradPlusSdk.setGlobalImpressionListener(
object : GlobalImpressionManager.GlobalImpressionListener {
override fun onImpressionSuccess(tpAdInfo: TPAdInfo?) {
// Ensure tpAdInfo is not null
if (tpAdInfo == null) {
println("AdInfo is null")
return
}
// Calculate revenue (assuming ecpm is a valid field)
val revenue = tpAdInfo.ecpm.toDouble() / 1000
// Validate the revenue value
if (revenue <= 0) {
println("Ad Revenue value out of expected range: $revenue")
return
}
// Create SingularAdData object with required fields
val data = SingularAdData(
adPlatform = "TradPlus",
currency = "USD", // Assuming USD, adjust if necessary
revenue = revenue
)
// Send the Ad Revenue data to Singular
Singular.adRevenue(data)
// Log for debugging
println("Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}")
}
}
)
작동 방식
- 트레이드플러스 연동: 트레이드플러스에서 보상형 광고를 로드하고 onImpressionSuccess 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import com.singular.sdk.Singular;
import com.singular.sdk.SingularAdData;
public class AdImpressionListener implements GlobalImpressionManager.GlobalImpressionListener {
private static final String TAG = "AdImpressionListener";
@Override
public void onImpressionSuccess(TPAdInfo tpAdInfo) {
// Ensure tpAdInfo is not null
if (tpAdInfo == null) {
Log.e(TAG, "AdInfo is null");
return;
}
// Ensure eCPM is valid and not null
if (tpAdInfo.getEcpm() == null) {
Log.e(TAG, "eCPM value is null");
return;
}
// Calculate revenue (assuming ecpm is in micros)
double revenue = tpAdInfo.getEcpm().doubleValue() / 1000;
// Validate the revenue value
if (revenue <= 0) {
Log.e(TAG, "Ad Revenue value out of expected range: " + revenue);
return;
}
// Create SingularAdData object with required fields
SingularAdData data = new SingularAdData(
"TradPlus",
"USD",
revenue
);
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Log for debugging
Log.d(TAG, "Ad Revenue reported to Singular: AdPlatform: " + data.getAdPlatform() +
", Currency: " + data.getCurrency() + ", Revenue: " + data.getRevenue());
}
}
작동 방식
- 트레이드플러스 연동: TradPlus에서 보상형 광고를 로드하고 setGlobalImpressionListener를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import 'package:singular_flutter_sdk/singular.dart';
void setupTradPlusImpressionListener() {
// Set up the global impression listener
TradPlusSdk.setGlobalImpressionListener((tpAdInfo) {
if (tpAdInfo == null) {
print("AdInfo is null");
return;
}
// Ensure eCPM is not null
if (tpAdInfo.ecpm == null) {
print("eCPM value is null");
return;
}
// Calculate revenue (assuming ecpm is in micros)
double revenue = tpAdInfo.ecpm / 1000.0;
// Validate the revenue value
if (revenue <= 0) {
print("Ad Revenue value out of expected range: $revenue");
return;
}
// Create SingularAdData object
final data = SingularAdData(
adPlatform: "TradPlus", // Ad platform name
currency: "USD", // Currency
revenue: revenue // Revenue
);
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Print log for debugging
print("Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}");
});
}
void main() {
// Initialize TradPlus SDK and other setup
setupTradPlusImpressionListener();
// Run your app
runApp(MyApp());
}
지원되지 않음:
TradPlus는 기본적으로 adInfo 객체를 통한 광고 구매 정보 캡처를 지원하지 않습니다. 코르도바 SDK는 일반적으로 Android 및 iOS용 기본 SDK에 비해 고급 기능이 더 제한적입니다.
고급 광고 구매 추적의 경우, 기본 TradPlus SDK와 직접 연동하거나 사용자 지정 플러그인을 사용하여 Cordova와 기본 SDK 간의 기능을 연결해야 할 수 있습니다. 광고 구매 데이터가 필요한 경우, 최신 정보를 얻기 위해 AppLovin 지원팀에 문의하거나 이 데이터를 캡처할 수 있는 다른 방법을 찾아보세요.
작동 방식
- TradPlus 연동: TradPlus에서 보상형 광고를 로드하고 광고 구매 이벤트를 처리하도록 onImpressionSuccess 리스너를 설정합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
import { NativeModules, NativeEventEmitter } from 'react-native';
import { Singular } from 'singular-react-native';
const { TradPlusModule } = NativeModules;
const tradPlusEventEmitter = new NativeEventEmitter(TradPlusModule);
const AD_PLATFORM = 'TradPlus';
const CURRENCY = 'USD'; // Assuming USD, adjust if necessary
tradPlusEventEmitter.addListener('onImpressionSuccess', (tpAdInfo) => {
if (!tpAdInfo) {
console.log('AdInfo is null');
return;
}
const revenue = tpAdInfo.ecpm / 1000;
// Validate the revenue to ensure it is within the expected range
if (revenue <= 0) {
console.warn(`Ad Revenue value out of expected range: ${revenue}`);
return;
}
// Create the ad revenue data object
const data = {
adPlatform: AD_PLATFORM,
currency: CURRENCY,
revenue: revenue,
};
// Send the revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging purposes
console.log(`Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}`);
});
작동 방식
- 트레이드플러스 연동: 트레이드플러스에서 보상형 광고를 로드하고 onImpressionSuccess 함수를 사용하여 광고 구매 이벤트를 처리합니다.
- 구매 검증: 구매이 0보다 큰지 확인하는 검사를 추가하여 0 또는 음수 구매 값을 전송하지 않도록 합니다. 광고정보 사전에는 유효한 NSNumber 값을 가진"ecpm" 키가 포함되어 있습니다. 이 값을 더블로 변환하고 배율을적용합니다(일반적으로 ecpm은 밀리 단위로 제공되므로 1000.0으로 나누면 달러로 변환됩니다).
- 통화 유효성 검사: 아래 샘플에서는 통화가 'USD'로 하드 코딩되어 있습니다. Singular로 데이터를 보내기 전에 통화가 정확하고 0이거나 비어 있지 않은지 확인하세요.
- 유효하지 않은 데이터 로깅: 데이터가 유효성 검사에 실패하면 디버깅을 위해 로그 메시지를 인쇄하고 데이터를 Singular로 보내지 마세요.
using Singular;
public class AdImpressionListener : MonoBehaviour
{
private const string TAG = "AdImpressionListener";
void Start()
{
// Add Global Ad Impression Listener
TradplusAds.Instance().AddGlobalAdImpression(OnGlobalAdImpression);
}
void OnGlobalAdImpression(Dictionary<string, object> adInfo)
{
// Ensure adInfo is not null
if (adInfo == null)
{
Debug.LogError($"{TAG}: AdInfo is null");
return;
}
// Ensure eCPM is present and valid
if (!adInfo.ContainsKey("ecpm") || adInfo["ecpm"] == null)
{
Debug.LogError($"{TAG}: eCPM value is null or missing");
return;
}
// Parse the eCPM value
if (!double.TryParse(adInfo["ecpm"].ToString(), NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out double revenue))
{
Debug.LogError($"{TAG}: Failed to parse eCPM value");
return;
}
// Convert eCPM to revenue (assuming eCPM is in micros)
revenue = revenue / 1000;
// Validate the revenue value
if (revenue <= 0)
{
Debug.LogError($"{TAG}: Ad Revenue value out of expected range: " + revenue);
return;
}
// Create SingularAdData object with the necessary fields
SingularAdData data = new SingularAdData(
"TradPlus", // Ad platform name
"USD", // Currency
revenue // Revenue value
);
// Send the Ad Revenue data to Singular
SingularSDK.AdRevenue(data);
// Log the data for debugging purposes
Debug.Log($"{TAG}: Ad Revenue reported to Singular: AdPlatform: {data.AdPlatform}, Currency: {data.Currency}, Revenue: {data.Revenue}");
}
}
파트너 참고 사항
- 일반 연동: SingularAdData 객체를 초기화하고 필요한 데이터를 전달합니다. 데이터에는 광고 플랫폼이 문자열로, 통화가 문자열로, 구매이 더블로 포함되어야 합니다.
- 구매 보고: 구매 및 통화 데이터가 올바른지 확인한 후 Singular로 전송하세요. 잘못된 데이터는 나중에 수정할 수 없으므로 정확한지 확인하는 것이 중요합니다.
- 팁: 디버깅을 위해 정보를 기록하세요.
SDK 구현을 위한 코드 베이스를 선택합니다:
import Singular
// Function to send Ad Revenue data to Singular
func reportAdRevenue(adPlatform: String, currency: String, revenue: Double) {
// Validate the revenue value
guard revenue > 0 else {
print("Invalid revenue value: \(revenue)")
return
}
// Create a SingularAdData object with the provided fields
let data = SingularAdData(
adPlatform: adPlatform,
currency: currency,
revenue: revenue
)
// Send the Ad Revenue data to Singular
Singular.adRevenue(data)
// Log the data for debugging
print("Ad Revenue reported to Singular: AdPlatform: \(data.adPlatform), Currency: \(data.currency), Revenue: \(data.revenue)")
}
#import <Singular/Singular.h>
// Function to send Ad Revenue data to Singular
- (void)reportAdRevenueWithPlatform:(NSString *)adPlatform currency:(NSString *)currency revenue:(double)revenue {
// Validate the revenue value
if (revenue <= 0) {
NSLog(@"Invalid revenue value: %f", revenue);
return;
}
// Create a SingularAdData object with the provided fields
SingularAdData *data = [[SingularAdData alloc] initWithAdPlatfrom:adPlatform currency:currency revenue:revenue];
// Send the Ad Revenue data to Singular
[Singular adRevenue:data];
// Log the data for debugging
NSLog(@"Ad Revenue reported to Singular: AdPlatform: %@, Currency: %@, Revenue: %f", data.adPlatform, data.currency, data.revenue);
}
import com.singular.sdk.Singular
import com.singular.sdk.SingularAdData
// Function to send Ad Revenue data to Singular
fun reportAdRevenue(adPlatform: String, currency: String, revenue: Double) {
// Validate the revenue value
if (revenue <= 0) {
println("Invalid revenue value: $revenue")
return
}
// Create a SingularAdData object with the provided fields
val data = SingularAdData(
adPlatform = adPlatform,
currency = currency,
revenue = revenue
)
// Send the Ad Revenue data to Singular
Singular.adRevenue(data)
// Log the data for debugging
println("Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}")
}
import com.singular.sdk.Singular;
import com.singular.sdk.SingularAdData;
// Function to send Ad Revenue data to Singular
public void reportAdRevenue(String adPlatform, String currency, double revenue) {
// Validate the revenue value
if (revenue <= 0) {
Log.w("AdRevenue", "Invalid revenue value: " + revenue);
return;
}
// Create a SingularAdData object with the provided fields
SingularAdData data = new SingularAdData(
adPlatform, // adPlatform
currency, // currency
revenue // revenue
);
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
Log.d("AdRevenue", "Ad Revenue reported to Singular: AdPlatform: " + data.getAdPlatform() + ", Currency: " + data.getCurrency() + ", Revenue: " + data.getRevenue());
}
import 'package:singular_flutter_sdk/singular.Flutter';
// Function to send Ad Revenue data to Singular
void reportAdRevenue({
required String adPlatform,
required String currency,
required double revenue,
}) {
// Validate the revenue value
if (revenue <= 0) {
print('Invalid revenue value: $revenue');
return;
}
// Create a SingularAdData object with the provided fields
final data = SingularAdData(
adPlatform: adPlatform,
currency: currency,
revenue: revenue,
);
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
print('Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}');
}
// Function to report Ad Revenue to Singular
function reportAdRevenue(mediationPlatform, currencyCode, revenueAmount) {
// Validate input values
if (!mediationPlatform || !currencyCode || typeof revenueAmount !== 'number' || revenueAmount <= 0) {
console.error("Invalid input for Ad Revenue reporting: ", {
mediationPlatform,
currencyCode,
revenueAmount
});
return;
}
try {
// Create a SingularAdData object
const adData = new cordova.plugins.SingularCordovaSdk.SingularAdData(
mediationPlatform,
currencyCode, // e.g., "USD"
revenueAmount
);
// Report Ad Revenue to Singular
cordova.plugins.SingularCordovaSdk.adRevenue(adData);
// Log success
console.log("Ad Revenue reported successfully: ", {
mediationPlatform: adData.mediationPlatform,
currencyCode: adData.currencyCode,
revenueAmount: adData.revenueAmount
});
} catch (error) {
// Log any errors that occur during the process
console.error("Failed to report Ad Revenue: ", error);
}
}
import { Singular } from 'singular-react-native';
const reportAdRevenue = (adPlatform, currency, revenue) => {
// Validate the revenue value
if (revenue <= 0) {
console.warn(`Invalid revenue value: ${revenue}`);
return;
}
// Create a SingularAdData object with the provided fields
const data = {
adPlatform: adPlatform,
currency: currency,
revenue: revenue,
};
// Send the Ad Revenue data to Singular
Singular.adRevenue(data);
// Log the data for debugging
console.log(`Ad Revenue reported to Singular: AdPlatform: ${data.adPlatform}, Currency: ${data.currency}, Revenue: ${data.revenue}`);
};
using Singular;
public class AdRevenueReporter : MonoBehaviour
{
// Function to report ad revenue to Singular
public void ReportAdRevenue(string adPlatform, float revenueInMicros, string currency)
{
// Convert revenue from micros to the standard unit (e.g., dollars)
float revenue = revenueInMicros / 1_000_000f;
// Validate the input: ensure revenue is positive and currency is not null or empty
if (revenue > 0 && !string.IsNullOrEmpty(currency))
{
// Create a SingularAdData object with the validated data
SingularAdData data = new SingularAdData(
adPlatform,
currency,
revenue
);
// Send the ad revenue data to Singular
SingularSDK.AdRevenue(data);
// Log the reported data for debugging
Debug.Log($"Ad Revenue reported to Singular: Platform = {adPlatform}, Currency = {currency}, Revenue = {revenue}");
}
else
{
// Log a warning if validation fails
Debug.LogWarning("Invalid ad revenue data: " +
$"Platform = {adPlatform}, Revenue = {revenue}, Currency = {currency}");
}
}
}