Commit a05317db authored by wanglei's avatar wanglei

...

parent d0c59b3f
......@@ -15,7 +15,7 @@ import com.google.firebase.ktx.Firebase
import org.json.JSONObject
object AdMaxEvent {
fun pullAd(ad: MaxAd?, adUnit: String, error: String? = null, reqId: String? = null) {
fun pullAd(ad: MaxAd?, adUnit: String, error: String? = null, reqId: String? = null, code: Int? = null) {
val obj = JSONObject()
obj.put("UnitId", ad?.adUnitId)
obj.put("ad_unit", adUnit)
......@@ -33,6 +33,7 @@ object AdMaxEvent {
if (error == null) {
obj.put("status", "1")
} else {
obj.put("code", code)
obj.put("errMsg", error)
obj.put("status", "2")
}
......@@ -53,15 +54,15 @@ object AdMaxEvent {
obj.put("networkplacement", ad?.networkPlacement)
obj.put("latency", ad?.requestLatencyMillis)
obj.put("valueMicros", ad?.revenue)
if(!adUnit.equals("nativeAd")){
if (!adUnit.equals("nativeAd")) {
EventUtils.event("ad_click", ext = obj)
}else{
} else {
EventUtils.event("big_imgad_click", ext = obj)
}
}
fun showAd(ad: MaxAd?, adUnit: String,activity: Activity?) {
fun showAd(ad: MaxAd?, adUnit: String, activity: Activity?) {
val obj = JSONObject()
obj.put("UnitId", ad?.adUnitId)
obj.put("ad_unit", adUnit)
......@@ -74,11 +75,11 @@ object AdMaxEvent {
obj.put("networkplacement", ad?.networkPlacement)
obj.put("latency", ad?.requestLatencyMillis)
obj.put("valueMicros", ad?.revenue)
obj.put("from",activity?.javaClass?.simpleName)
LogEx.logDebug("glc","from: "+activity?.javaClass?.simpleName)
if(!adUnit.equals("nativeAd")){
obj.put("from", activity?.javaClass?.simpleName)
LogEx.logDebug("glc", "from: " + activity?.javaClass?.simpleName)
if (!adUnit.equals("nativeAd")) {
EventUtils.event("ad_show", ext = obj)
}else{
} else {
EventUtils.event("big_img_show", ext = obj)
}
......@@ -90,7 +91,7 @@ object AdMaxEvent {
class EventOnPaidEventListener : MaxAdRevenueListener {
override fun onAdRevenuePaid(ad: MaxAd) {
LogEx.logDebug("glc","onAdRevenuePaid")
LogEx.logDebug("glc", "onAdRevenuePaid")
val params = Bundle()
val currentImpressionRevenue: Double = ad.revenue // In USD
val mFirebaseAnalytics = FirebaseAnalytics.getInstance(BaseApplication.context)
......
......@@ -49,7 +49,7 @@ object AdMaxInterstitialUtils {
override fun onAdLoadFailed(p0: String, p1: MaxError) {
LogEx.logDebug(TAG, "onAdLoadFailed")
val reqId = UUID.randomUUID().toString()
AdMaxEvent.pullAd(null, "interAd", reqId = reqId)
AdMaxEvent.pullAd(null, "interAd", reqId = reqId, error = p1.message, code = p1.code)
AdDisplayUtils.getInstance().incrementAdRequestFailCount()
retryAttempt++
LogEx.logDebug(TAG, "onAdLoadFailed retryAttempt=$retryAttempt")
......
......@@ -37,7 +37,7 @@ object AdMaxOpenUtils {
LogEx.logDebug(TAG, "onAdLoadFailed:" + p1.message.toString())
onHidden?.invoke()
AdDisplayUtils.getInstance().incrementAdRequestFailCount()
AdMaxEvent.pullAd(null, "openAd")
AdMaxEvent.pullAd(null, "openAd", error = p1.message, code = p1.code)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment