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