update: 规范广告字段封装
Signed-off-by: huyufei <yufei.hu@castbox.fm>
parent
c719eb2edb
commit
c489786038
|
|
@ -1,12 +1,18 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Guru
|
namespace Guru
|
||||||
{
|
{
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 广告打点上报参数
|
/// 广告打点上报参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AdParams
|
public class AdParams
|
||||||
{
|
{
|
||||||
|
private const int MAX_VALUE_LENGTH = 96;
|
||||||
|
private const string VALUE_NOT_SET = "not_set";
|
||||||
|
|
||||||
|
|
||||||
public double value;
|
public double value;
|
||||||
public string currency;
|
public string currency;
|
||||||
public string category;
|
public string category;
|
||||||
|
|
@ -39,9 +45,9 @@ namespace Guru
|
||||||
var networkPlacement = "";
|
var networkPlacement = "";
|
||||||
var creativeId = "";
|
var creativeId = "";
|
||||||
var adSource = "";
|
var adSource = "";
|
||||||
var adFormart = "";
|
var adFormat = "";
|
||||||
double value = 0;
|
double value = 0;
|
||||||
string waterfallName = "";
|
// string waterfallName = "";
|
||||||
|
|
||||||
if (adInfo != null)
|
if (adInfo != null)
|
||||||
{
|
{
|
||||||
|
|
@ -49,12 +55,28 @@ namespace Guru
|
||||||
networkPlacement = adInfo.NetworkPlacement;
|
networkPlacement = adInfo.NetworkPlacement;
|
||||||
creativeId = adInfo.CreativeIdentifier;
|
creativeId = adInfo.CreativeIdentifier;
|
||||||
adSource = adInfo.NetworkName;
|
adSource = adInfo.NetworkName;
|
||||||
adFormart = adInfo.AdFormat;
|
adFormat = adInfo.AdFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(adPlatform)) adPlatform = Analytics.AdMAX;
|
if (string.IsNullOrEmpty(adPlatform)) adPlatform = Analytics.AdMAX;
|
||||||
if (string.IsNullOrEmpty(category)) category = "not_set";
|
if (string.IsNullOrEmpty(category)) category = VALUE_NOT_SET;
|
||||||
if (string.IsNullOrEmpty(currency)) currency = Analytics.USD;
|
if (string.IsNullOrEmpty(currency)) currency = Analytics.USD;
|
||||||
|
if (string.IsNullOrEmpty(creativeId))
|
||||||
|
{
|
||||||
|
creativeId = VALUE_NOT_SET;
|
||||||
|
}
|
||||||
|
else if(creativeId.Length > MAX_VALUE_LENGTH)
|
||||||
|
{
|
||||||
|
creativeId = creativeId.Substring(0, MAX_VALUE_LENGTH);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(reviewCreativeId))
|
||||||
|
{
|
||||||
|
reviewCreativeId = VALUE_NOT_SET;
|
||||||
|
}
|
||||||
|
else if(reviewCreativeId.Length > MAX_VALUE_LENGTH)
|
||||||
|
{
|
||||||
|
reviewCreativeId = reviewCreativeId.Substring(0, MAX_VALUE_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
var p = new AdParams()
|
var p = new AdParams()
|
||||||
{
|
{
|
||||||
|
|
@ -63,7 +85,7 @@ namespace Guru
|
||||||
adUnitId = adUnitId,
|
adUnitId = adUnitId,
|
||||||
adPlatform = adPlatform,
|
adPlatform = adPlatform,
|
||||||
adSource = adSource,
|
adSource = adSource,
|
||||||
adFormat = adFormart,
|
adFormat = adFormat,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
networkPlacement = networkPlacement,
|
networkPlacement = networkPlacement,
|
||||||
category = category,
|
category = category,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue