-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathInsight.cs
More file actions
112 lines (95 loc) · 3.17 KB
/
Insight.cs
File metadata and controls
112 lines (95 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Collections.Generic;
using UnityEngine;
// LINT.IfChange
namespace GoogleMobileAds.Common
{
// Protos are not supported in g3 for C#: http://yaqs/6221611834537934848. Instead, we use
// JSON Lines (http://jsonlines.org) to serialize the insights.
[Serializable]
public class Insight
{
public Insight()
{
StartTimeMillis = (long)DateTime.UtcNow
.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))
.TotalMilliseconds;
}
public enum CuiName
{
Unknown = 0,
SdkInitialized = 1,
AdRequested = 2,
AdLoaded = 3,
AdFailedToLoad = 4,
AdShown = 5,
AdClosed = 6,
AdClicked = 7,
}
public enum AdFormat
{
Unknown = 0,
Banner = 1,
Interstitial = 2,
Rewarded = 3,
RewardedInterstitial = 4,
AppOpen = 5,
Native = 6,
}
public enum AdPlatform
{
Unknown = 0,
Android = 1,
Ios = 2,
Unity = 3,
}
// The name of the insight, commonly referred as a CUI (Critical User Interaction).
public CuiName Name;
// If the event associated with the insight succeeded or failed.
public bool Success;
// The Epoch time in milliseconds when the CUI started.
public long StartTimeMillis;
// How long the operation took to complete in milliseconds.
public long LatencyMillis;
// The GMA SDK version.
public string SdkVersion;
// The AdMob / Google Ad Manager app id.
public string AppId;
// The ad unit ID.
public string AdUnitId;
// The format of the ad.
public AdFormat Format;
// The platform on which the CUI was performed.
public AdPlatform Platform;
// The keywords associated with the insight. They are used to group insights together for
// analysis.
public List<string> Tags;
// Any additional details about the insight.
public string Details;
// Returns a string representation of the insight.
public override string ToString()
{
return string.Format(
"Insight[Name={0}, Success={1}, StartTimeMillis={2}, LatencyMillis={3}, " +
"SdkVersion='{4}', AppId='{5}', AdUnitId='{6}', Format={7}, Platform={8}, " +
"Tags='{9}', Details='{10}']",
Name,
Success,
StartTimeMillis,
LatencyMillis,
SdkVersion,
AppId,
AdUnitId,
Format,
Platform,
string.Join(",", Tags),
Details);
}
// Returns a JSON string representation of the insight.
public string ToJson()
{
return JsonUtility.ToJson(this, prettyPrint: true);
}
}
}
// LINT.ThenChange(//depot/google3/javatests/com/google/android/apps/internal/admobsdk/mediumtest/unityplugin/Insight.java)