embulk-parser-twitter_ads_stats 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.scalafmt.conf +7 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +79 -0
  6. data/build.gradle +79 -0
  7. data/build.sbt +15 -0
  8. data/classpath/embulk-parser-twitter_ads_stats-0.1.0.jar +0 -0
  9. data/classpath/scala-library-2.12.3.jar +0 -0
  10. data/classpath/spray-json_2.12-1.3.3.jar +0 -0
  11. data/gradle/wrapper/gradle-wrapper.jar +0 -0
  12. data/gradle/wrapper/gradle-wrapper.properties +5 -0
  13. data/gradlew +172 -0
  14. data/gradlew.bat +84 -0
  15. data/lib/embulk/guess/twitter_ads_stats.rb +61 -0
  16. data/lib/embulk/parser/twitter_ads_stats.rb +3 -0
  17. data/project/Dependencies.scala +11 -0
  18. data/project/build.properties +1 -0
  19. data/project/plugins.sbt +2 -0
  20. data/src/main/scala/org/embulk/parser/twitter_ads_stats/Column.scala +50 -0
  21. data/src/main/scala/org/embulk/parser/twitter_ads_stats/LoanPattern.scala +19 -0
  22. data/src/main/scala/org/embulk/parser/twitter_ads_stats/MetricElementNames.scala +47 -0
  23. data/src/main/scala/org/embulk/parser/twitter_ads_stats/MetricsGroupJson.scala +19 -0
  24. data/src/main/scala/org/embulk/parser/twitter_ads_stats/ParseException.scala +27 -0
  25. data/src/main/scala/org/embulk/parser/twitter_ads_stats/PluginTask.scala +9 -0
  26. data/src/main/scala/org/embulk/parser/twitter_ads_stats/TwitterAdsStatsParserPlugin.scala +98 -0
  27. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Data.scala +19 -0
  28. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/FieldNameUtil.scala +9 -0
  29. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/IDData.scala +36 -0
  30. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Metrics.scala +23 -0
  31. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Request.scala +42 -0
  32. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/Root.scala +21 -0
  33. data/src/main/scala/org/embulk/parser/twitter_ads_stats/define/RootJson.scala +107 -0
  34. data/src/main/scala/org/embulk/parser/twitter_ads_stats/package.scala +192 -0
  35. data/src/test/resources/test.json +759 -0
  36. data/src/test/scala/org/embulk/parser/twitter_ads_stats/ColumnSpec.scala +33 -0
  37. data/src/test/scala/org/embulk/parser/twitter_ads_stats/MetricElementNamesSpec.scala +14 -0
  38. data/src/test/scala/org/embulk/parser/twitter_ads_stats/MetricsGroupJsonSpec.scala +20 -0
  39. data/src/test/scala/org/embulk/parser/twitter_ads_stats/UnitSpec.scala +5 -0
  40. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/MetricsJsonSpec.scala +57 -0
  41. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/ParamsSpec.scala +26 -0
  42. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/RootJsonSpec.scala +20 -0
  43. data/src/test/scala/org/embulk/parser/twitter_ads_stats/define/RootSpec.scala +356 -0
  44. metadata +114 -0
@@ -0,0 +1,42 @@
1
+ package org.embulk.parser.twitter_ads_stats.define
2
+
3
+ import java.time.{LocalDate, LocalDateTime}
4
+
5
+ case class Request(
6
+ params: Params
7
+ )
8
+
9
+ object Request {
10
+ val fieldNames: Array[String] = FieldNameUtil.fieldList[Request]
11
+ }
12
+
13
+ case class Params(
14
+ start_time: LocalDateTime,
15
+ end_time: LocalDateTime,
16
+ placement: String
17
+ ) {
18
+ require(!start_time.isAfter(end_time))
19
+
20
+ val startDate = start_time.toLocalDate
21
+ val endDate = end_time.toLocalDate
22
+
23
+ /**
24
+ * MetricTimeSeries の期間
25
+ * 開始日~(終了日 - 1)
26
+ */
27
+ def targetDates: List[LocalDate] = {
28
+ @scala.annotation.tailrec
29
+ def loop(curDate: LocalDate, acc: List[LocalDate]): List[LocalDate] = {
30
+ acc match {
31
+ case x :: _ if !x.isBefore(endDate.minusDays(1)) => acc.reverse
32
+ case _ => loop(curDate.plusDays(1), curDate :: acc)
33
+ }
34
+ }
35
+
36
+ loop(startDate, Nil)
37
+ }
38
+ }
39
+
40
+ object Params {
41
+ val fieldNames: Array[String] = FieldNameUtil.fieldList[Params]
42
+ }
@@ -0,0 +1,21 @@
1
+ package org.embulk.parser.twitter_ads_stats.define
2
+
3
+ import org.embulk.parser.twitter_ads_stats.{Column, MetricElementNames, ParseException}
4
+
5
+ case class Root(
6
+ data: Seq[Data],
7
+ request: Request
8
+ ) {
9
+ def resolveColumns(metricElementNames: MetricElementNames): Either[ParseException, Seq[Column]] = {
10
+ data.map { d =>
11
+ d.resolveColumns(metricElementNames, request)
12
+ }.foldRight[Either[ParseException, Seq[Column]]](Right(Nil)) {
13
+ case (Left(e), _) => Left(e)
14
+ case (Right(_), Left(e)) => Left(e)
15
+ case (Right(seq1), Right(seq2)) => Right(seq1 ++: seq2)
16
+ }
17
+ }
18
+ }
19
+ object Root {
20
+ val fieldNames:Array[String] = FieldNameUtil.fieldList[Root]
21
+ }
@@ -0,0 +1,107 @@
1
+ package org.embulk.parser.twitter_ads_stats.define
2
+
3
+ import java.time.LocalDateTime
4
+ import java.time.format.DateTimeFormatter
5
+
6
+ import org.embulk.parser.twitter_ads_stats.{MetricElementNames, MetricTimeSeries}
7
+ import spray.json.{DefaultJsonProtocol, DeserializationException, JsArray, JsString, JsValue, RootJsonReader}
8
+
9
+ class RootJson(metricElementNames: MetricElementNames) extends DefaultJsonProtocol {
10
+
11
+ object MetricsReader extends RootJsonReader[Metrics] {
12
+
13
+ private def readMetricTimeSeries(jsValue: JsValue): MetricTimeSeries = {
14
+ jsValue match {
15
+ case JsArray(arr) => Some(arr.map(_.convertTo[Long]))
16
+ case _ => None
17
+ }
18
+ }
19
+
20
+ override def read(json: JsValue): Metrics = {
21
+ @scala.annotation.tailrec
22
+ def loop(curMetricNames: List[String], curJsValue: Option[JsValue]): MetricTimeSeries = {
23
+ curMetricNames match {
24
+ case Nil =>
25
+ curJsValue.flatMap(readMetricTimeSeries)
26
+ case x :: xs =>
27
+ loop(xs, curJsValue.flatMap(_.asJsObject.fields.get(x)))
28
+ }
29
+ }
30
+
31
+ metricElementNames.resolveMetrics(loop, json.asJsObject)
32
+ }
33
+ }
34
+
35
+ object IDDataReader extends RootJsonReader[IDData] {
36
+ override def read(json: JsValue): IDData = {
37
+ val fieldNames = IDData.fieldNames.toList
38
+ json.asJsObject.getFields(fieldNames: _*) match {
39
+ case Seq(a: JsValue, b) =>
40
+ IDData(
41
+ MetricsReader.read(a.asJsObject),
42
+ b.convertTo[Option[String]]
43
+ )
44
+ case x => throw DeserializationException(msg = s"id_data can't deserialize json: $x", fieldNames = fieldNames)
45
+ }
46
+ }
47
+ }
48
+
49
+ object DataReader extends RootJsonReader[Data] {
50
+ override def read(json: JsValue): Data = {
51
+ val fieldNames = Data.fieldNames.toList
52
+ json.asJsObject.getFields(fieldNames: _*) match {
53
+ case Seq(a, JsArray(b)) =>
54
+ Data(
55
+ a.convertTo[String],
56
+ b.map(IDDataReader.read)
57
+ )
58
+ case x => throw DeserializationException(msg = s"data can't deserialize json: $x", fieldNames = fieldNames)
59
+ }
60
+ }
61
+ }
62
+
63
+ object RequestFormat extends RootJsonReader[Request] {
64
+
65
+ implicit object ParamsJsonFormat extends RootJsonReader[Params] {
66
+
67
+ override def read(json: JsValue): Params = {
68
+ val fieldNames = Params.fieldNames.toList
69
+ json.asJsObject.getFields(fieldNames: _*) match {
70
+ case Seq(JsString(a), JsString(b), c) =>
71
+ val formatter = DateTimeFormatter.ISO_DATE_TIME
72
+ //todo DateTimeFormatterでフォーマットが出来ない場合の例外処理
73
+ Params(
74
+ LocalDateTime.parse(a, formatter),
75
+ LocalDateTime.parse(b, formatter),
76
+ c.convertTo[String]
77
+ )
78
+ case x => throw DeserializationException(msg = s"params can't deserialize json: $x", fieldNames = fieldNames)
79
+ }
80
+ }
81
+ }
82
+
83
+ override def read(json: JsValue): Request = {
84
+ val fieldNames = Request.fieldNames.toList
85
+ json.asJsObject.getFields(fieldNames: _*) match {
86
+ case Seq(params) =>
87
+ Request(ParamsJsonFormat.read(params))
88
+ case x => throw DeserializationException(msg = s"request can't deserialize json: $x", fieldNames = fieldNames)
89
+ }
90
+ }
91
+ }
92
+
93
+ object RootReader extends RootJsonReader[Root] {
94
+ override def read(json: JsValue): Root = {
95
+ val fieldNames = Root.fieldNames.toList
96
+ json.asJsObject.getFields(fieldNames: _*) match {
97
+ case Seq(JsArray(data), request) =>
98
+ Root(
99
+ data.map(DataReader.read),
100
+ RequestFormat.read(request)
101
+ )
102
+ case x => throw DeserializationException(msg = s"root can't deserialize json: $x", fieldNames = fieldNames)
103
+ }
104
+ }
105
+ }
106
+
107
+ }
@@ -0,0 +1,192 @@
1
+ package org.embulk.parser
2
+
3
+ package object twitter_ads_stats {
4
+ type MetricTimeSeries = Option[Vector[Long]]
5
+ type MetricsGroup = Map[String, Option[Long]]
6
+
7
+ val metricElementNames = MetricElementNames(
8
+ Map(
9
+ "billing" -> Seq(
10
+ "billed_engagements",
11
+ "billed_charge_local_micro"
12
+ ),
13
+ "engagement" -> Seq(
14
+ "engagements",
15
+ "impressions",
16
+ "retweets",
17
+ "replies",
18
+ "likes",
19
+ "follows",
20
+ "card_engagements",
21
+ "clicks",
22
+ "app_clicks",
23
+ "url_clicks",
24
+ "qualified_impressions"
25
+ ),
26
+ "media" -> Seq(
27
+ "media_views",
28
+ "media_engagements"
29
+ ),
30
+ "mobile_conversion" -> Seq(
31
+ "mobile_conversion_spent_credits.post_view",
32
+ "mobile_conversion_spent_credits.post_engagement",
33
+ "mobile_conversion_spent_credits.assisted",
34
+ "mobile_conversion_spent_credits.order_quantity",
35
+ "mobile_conversion_spent_credits.sale_amount",
36
+ "mobile_conversion_installs.post_view",
37
+ "mobile_conversion_installs.post_engagement",
38
+ "mobile_conversion_installs.assisted",
39
+ "mobile_conversion_installs.order_quantity",
40
+ "mobile_conversion_installs.sale_amount",
41
+ "mobile_conversion_content_views.post_view",
42
+ "mobile_conversion_content_views.post_engagement",
43
+ "mobile_conversion_content_views.assisted",
44
+ "mobile_conversion_content_views.order_quantity",
45
+ "mobile_conversion_content_views.sale_amount",
46
+ "mobile_conversion_add_to_wishlists.post_view",
47
+ "mobile_conversion_add_to_wishlists.post_engagement",
48
+ "mobile_conversion_add_to_wishlists.assisted",
49
+ "mobile_conversion_add_to_wishlists.order_quantity",
50
+ "mobile_conversion_add_to_wishlists.sale_amount",
51
+ "mobile_conversion_checkouts_initiated.post_view",
52
+ "mobile_conversion_checkouts_initiated.post_engagement",
53
+ "mobile_conversion_checkouts_initiated.assisted",
54
+ "mobile_conversion_checkouts_initiated.order_quantity",
55
+ "mobile_conversion_checkouts_initiated.sale_amount",
56
+ "mobile_conversion_reservations.post_view",
57
+ "mobile_conversion_reservations.post_engagement",
58
+ "mobile_conversion_reservations.assisted",
59
+ "mobile_conversion_reservations.order_quantity",
60
+ "mobile_conversion_reservations.sale_amount",
61
+ "mobile_conversion_tutorials_completed.post_view",
62
+ "mobile_conversion_tutorials_completed.post_engagement",
63
+ "mobile_conversion_tutorials_completed.assisted",
64
+ "mobile_conversion_tutorials_completed.order_quantity",
65
+ "mobile_conversion_tutorials_completed.sale_amount",
66
+ "mobile_conversion_achievements_unlocked.post_view",
67
+ "mobile_conversion_achievements_unlocked.post_engagement",
68
+ "mobile_conversion_achievements_unlocked.assisted",
69
+ "mobile_conversion_achievements_unlocked.order_quantity",
70
+ "mobile_conversion_achievements_unlocked.sale_amount",
71
+ "mobile_conversion_searches.post_view",
72
+ "mobile_conversion_searches.post_engagement",
73
+ "mobile_conversion_searches.assisted",
74
+ "mobile_conversion_searches.order_quantity",
75
+ "mobile_conversion_searches.sale_amount",
76
+ "mobile_conversion_add_to_carts.post_view",
77
+ "mobile_conversion_add_to_carts.post_engagement",
78
+ "mobile_conversion_add_to_carts.assisted",
79
+ "mobile_conversion_add_to_carts.order_quantity",
80
+ "mobile_conversion_add_to_carts.sale_amount",
81
+ "mobile_conversion_payment_info_additions.post_view",
82
+ "mobile_conversion_payment_info_additions.post_engagement",
83
+ "mobile_conversion_payment_info_additions.assisted",
84
+ "mobile_conversion_payment_info_additions.order_quantity",
85
+ "mobile_conversion_payment_info_additions.sale_amount",
86
+ "mobile_conversion_re_engages.post_view",
87
+ "mobile_conversion_re_engages.post_engagement",
88
+ "mobile_conversion_re_engages.assisted",
89
+ "mobile_conversion_re_engages.order_quantity",
90
+ "mobile_conversion_re_engages.sale_amount",
91
+ "mobile_conversion_shares.post_view",
92
+ "mobile_conversion_shares.post_engagement",
93
+ "mobile_conversion_shares.assisted",
94
+ "mobile_conversion_shares.order_quantity",
95
+ "mobile_conversion_shares.sale_amount",
96
+ "mobile_conversion_rates.post_view",
97
+ "mobile_conversion_rates.post_engagement",
98
+ "mobile_conversion_rates.assisted",
99
+ "mobile_conversion_rates.order_quantity",
100
+ "mobile_conversion_rates.sale_amount",
101
+ "mobile_conversion_logins.post_view",
102
+ "mobile_conversion_logins.post_engagement",
103
+ "mobile_conversion_logins.assisted",
104
+ "mobile_conversion_logins.order_quantity",
105
+ "mobile_conversion_logins.sale_amount",
106
+ "mobile_conversion_updates.post_view",
107
+ "mobile_conversion_updates.post_engagement",
108
+ "mobile_conversion_updates.assisted",
109
+ "mobile_conversion_updates.order_quantity",
110
+ "mobile_conversion_updates.sale_amount",
111
+ "mobile_conversion_levels_achieved.post_view",
112
+ "mobile_conversion_levels_achieved.post_engagement",
113
+ "mobile_conversion_levels_achieved.assisted",
114
+ "mobile_conversion_levels_achieved.order_quantity",
115
+ "mobile_conversion_levels_achieved.sale_amount",
116
+ "mobile_conversion_invites.post_view",
117
+ "mobile_conversion_invites.post_engagement",
118
+ "mobile_conversion_invites.assisted",
119
+ "mobile_conversion_invites.order_quantity",
120
+ "mobile_conversion_invites.sale_amount",
121
+ "mobile_conversion_key_page_views.post_view",
122
+ "mobile_conversion_key_page_views.post_engagement",
123
+ "mobile_conversion_key_page_views.assisted",
124
+ "mobile_conversion_key_page_views.order_quantity.order_quantity",
125
+ "mobile_conversion_key_page_views.sale_amount"
126
+ ),
127
+ "video" -> Seq(
128
+ "video_total_views",
129
+ "video_views_25",
130
+ "video_views_50",
131
+ "video_views_75",
132
+ "video_views_100",
133
+ "video_cta_clicks",
134
+ "video_content_starts",
135
+ "video_mrc_views",
136
+ "video_3s100pct_views"
137
+ ),
138
+ "web_conversion" -> Seq(
139
+ "conversion_purchases.assisted",
140
+ "conversion_purchases.metric",
141
+ "conversion_purchases.order_quantity",
142
+ "conversion_purchases.order_quantity_engagement",
143
+ "conversion_purchases.order_quantity_view",
144
+ "conversion_purchases.post_engagement",
145
+ "conversion_purchases.post_view",
146
+ "conversion_purchases.sale_amount",
147
+ "conversion_purchases.sale_amount_engagement",
148
+ "conversion_purchases.sale_amount_view",
149
+ "conversion_sign_ups.assisted",
150
+ "conversion_sign_ups.metric",
151
+ "conversion_sign_ups.order_quantity",
152
+ "conversion_sign_ups.order_quantity_engagement",
153
+ "conversion_sign_ups.order_quantity_view",
154
+ "conversion_sign_ups.post_engagement",
155
+ "conversion_sign_ups.post_view",
156
+ "conversion_sign_ups.sale_amount",
157
+ "conversion_sign_ups.sale_amount_engagement",
158
+ "conversion_sign_ups.sale_amount_view",
159
+ "conversion_site_visits.assisted",
160
+ "conversion_site_visits.metric",
161
+ "conversion_site_visits.order_quantity",
162
+ "conversion_site_visits.order_quantity_engagement",
163
+ "conversion_site_visits.order_quantity_view",
164
+ "conversion_site_visits.post_engagement",
165
+ "conversion_site_visits.post_view",
166
+ "conversion_site_visits.sale_amount",
167
+ "conversion_site_visits.sale_amount_engagement",
168
+ "conversion_site_visits.sale_amount_view",
169
+ "conversion_downloads.assisted",
170
+ "conversion_downloads.metric",
171
+ "conversion_downloads.order_quantity",
172
+ "conversion_downloads.order_quantity_engagement",
173
+ "conversion_downloads.order_quantity_view",
174
+ "conversion_downloads.post_engagement",
175
+ "conversion_downloads.post_view",
176
+ "conversion_downloads.sale_amount",
177
+ "conversion_downloads.sale_amount_engagement",
178
+ "conversion_downloads.sale_amount_view",
179
+ "conversion_custom.assisted",
180
+ "conversion_custom.metric",
181
+ "conversion_custom.order_quantity",
182
+ "conversion_custom.order_quantity_engagement",
183
+ "conversion_custom.order_quantity_view",
184
+ "conversion_custom.post_engagement",
185
+ "conversion_custom.post_view",
186
+ "conversion_custom.sale_amount",
187
+ "conversion_custom.sale_amount_engagement",
188
+ "conversion_custom.sale_amount_view"
189
+ )
190
+ )
191
+ )
192
+ }
@@ -0,0 +1,759 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": "xxxxx",
5
+ "id_data": [
6
+ {
7
+ "metrics": {
8
+ "app_clicks": [
9
+ 100,
10
+ 200,
11
+ 300,
12
+ 400,
13
+ 500,
14
+ 600,
15
+ 700,
16
+ 800
17
+ ],
18
+ "auto_created_conversion_add_to_cart": null,
19
+ "auto_created_conversion_add_to_wish_list": null,
20
+ "auto_created_conversion_added_payment_info": null,
21
+ "auto_created_conversion_checkout_initiated": null,
22
+ "auto_created_conversion_complete_registration": null,
23
+ "auto_created_conversion_content_view": null,
24
+ "auto_created_conversion_download": null,
25
+ "auto_created_conversion_page_view": null,
26
+ "auto_created_conversion_purchase": null,
27
+ "auto_created_conversion_search": null,
28
+ "auto_created_conversion_sign_up_initiated": null,
29
+ "billed_charge_local_micro": [
30
+ 100000000000,
31
+ 200000000000,
32
+ 300000000000,
33
+ 400000000000,
34
+ 500000000000,
35
+ 600000000000,
36
+ 700000000000,
37
+ 800000000000
38
+ ],
39
+ "billed_engagements": [
40
+ 100,
41
+ 200,
42
+ 300,
43
+ 400,
44
+ 500,
45
+ 600,
46
+ 700,
47
+ 800
48
+ ],
49
+ "card_engagements": [
50
+ 100,
51
+ 200,
52
+ 300,
53
+ 400,
54
+ 500,
55
+ 600,
56
+ 700,
57
+ 800
58
+ ],
59
+ "carousel_swipes": null,
60
+ "clicks": [
61
+ 100,
62
+ 200,
63
+ 300,
64
+ 400,
65
+ 500,
66
+ 600,
67
+ 700,
68
+ 800
69
+ ],
70
+ "conversion_custom": {
71
+ "metric": null,
72
+ "order_quantity": null,
73
+ "order_quantity_engagement": null,
74
+ "order_quantity_view": null,
75
+ "post_engagement": null,
76
+ "post_view": null,
77
+ "sale_amount": null,
78
+ "sale_amount_engagement": null,
79
+ "sale_amount_view": null
80
+ },
81
+ "conversion_downloads": {
82
+ "metric": null,
83
+ "order_quantity": null,
84
+ "order_quantity_engagement": null,
85
+ "order_quantity_view": null,
86
+ "post_engagement": null,
87
+ "post_view": null,
88
+ "sale_amount": null,
89
+ "sale_amount_engagement": null,
90
+ "sale_amount_view": null
91
+ },
92
+ "conversion_purchases": {
93
+ "assisted": [
94
+ 1,
95
+ 2,
96
+ 3,
97
+ 4,
98
+ 5,
99
+ 6,
100
+ 7,
101
+ 8
102
+ ],
103
+ "metric": [
104
+ 1,
105
+ 2,
106
+ 3,
107
+ 4,
108
+ 5,
109
+ 6,
110
+ 7,
111
+ 8
112
+ ],
113
+ "order_quantity": null,
114
+ "order_quantity_engagement": null,
115
+ "order_quantity_view": null,
116
+ "post_engagement": [
117
+ 1,
118
+ 2,
119
+ 3,
120
+ 4,
121
+ 5,
122
+ 6,
123
+ 7,
124
+ 8
125
+ ],
126
+ "post_view": null,
127
+ "sale_amount": [
128
+ 100000000,
129
+ 200000000,
130
+ 300000000,
131
+ 400000000,
132
+ 500000000,
133
+ 600000000,
134
+ 700000000,
135
+ 800000000
136
+ ],
137
+ "sale_amount_engagement": null,
138
+ "sale_amount_view": null
139
+ },
140
+ "conversion_sign_ups": {
141
+ "assisted": null,
142
+ "metric": null,
143
+ "order_quantity": null,
144
+ "order_quantity_engagement": null,
145
+ "order_quantity_view": null,
146
+ "post_engagement": null,
147
+ "post_view": null,
148
+ "sale_amount": null,
149
+ "sale_amount_engagement": null,
150
+ "sale_amount_view": null
151
+ },
152
+ "conversion_site_visits": {
153
+ "metric": [
154
+ 1,
155
+ 2,
156
+ 3,
157
+ 4,
158
+ 5,
159
+ 6,
160
+ 7,
161
+ 8
162
+ ],
163
+ "order_quantity": null,
164
+ "order_quantity_engagement": null,
165
+ "order_quantity_view": null,
166
+ "post_engagement": [
167
+ 1,
168
+ 2,
169
+ 3,
170
+ 4,
171
+ 5,
172
+ 6,
173
+ 7,
174
+ 8
175
+ ],
176
+ "post_view": null,
177
+ "sale_amount": null,
178
+ "sale_amount_engagement": null,
179
+ "sale_amount_view": null
180
+ },
181
+ "engagements": [
182
+ 1,
183
+ 2,
184
+ 3,
185
+ 4,
186
+ 5,
187
+ 6,
188
+ 7,
189
+ 8
190
+ ],
191
+ "follows": [
192
+ 1,
193
+ 2,
194
+ 3,
195
+ 4,
196
+ 5,
197
+ 6,
198
+ 7,
199
+ 8
200
+ ],
201
+ "impressions": [
202
+ 1,
203
+ 2,
204
+ 3,
205
+ 4,
206
+ 5,
207
+ 6,
208
+ 7,
209
+ 8
210
+ ],
211
+ "likes": [
212
+ 1,
213
+ 2,
214
+ 3,
215
+ 4,
216
+ 5,
217
+ 6,
218
+ 7,
219
+ 8
220
+ ],
221
+ "media_engagements": [
222
+ 1,
223
+ 2,
224
+ 3,
225
+ 4,
226
+ 5,
227
+ 6,
228
+ 7,
229
+ 8
230
+ ],
231
+ "media_views": [
232
+ 1,
233
+ 2,
234
+ 3,
235
+ 4,
236
+ 5,
237
+ 6,
238
+ 7,
239
+ 8
240
+ ],
241
+ "mobile_conversion_achievements_unlocked": {
242
+ "assisted": null,
243
+ "order_quantity": null,
244
+ "post_engagement": null,
245
+ "post_view": null,
246
+ "sale_amount": null
247
+ },
248
+ "mobile_conversion_add_to_carts": {
249
+ "assisted": null,
250
+ "order_quantity": null,
251
+ "post_engagement": null,
252
+ "post_view": null,
253
+ "sale_amount": null
254
+ },
255
+ "mobile_conversion_add_to_wishlists": {
256
+ "assisted": null,
257
+ "order_quantity": null,
258
+ "post_engagement": null,
259
+ "post_view": null,
260
+ "sale_amount": null
261
+ },
262
+ "mobile_conversion_checkouts_initiated": {
263
+ "assisted": null,
264
+ "order_quantity": null,
265
+ "post_engagement": null,
266
+ "post_view": null,
267
+ "sale_amount": null
268
+ },
269
+ "mobile_conversion_content_views": {
270
+ "assisted": null,
271
+ "order_quantity": null,
272
+ "post_engagement": null,
273
+ "post_view": null,
274
+ "sale_amount": null
275
+ },
276
+ "mobile_conversion_downloads": {
277
+ "order_quantity": null,
278
+ "post_engagement": null,
279
+ "post_view": null,
280
+ "sale_amount": null
281
+ },
282
+ "mobile_conversion_installs": {
283
+ "assisted": [
284
+ 1,
285
+ 2,
286
+ 3,
287
+ 4,
288
+ 5,
289
+ 6,
290
+ 7,
291
+ 8
292
+ ],
293
+ "order_quantity": null,
294
+ "post_engagement": [
295
+ 1,
296
+ 2,
297
+ 3,
298
+ 4,
299
+ 5,
300
+ 6,
301
+ 7,
302
+ 8
303
+ ],
304
+ "post_view": null,
305
+ "sale_amount": null
306
+ },
307
+ "mobile_conversion_invites": {
308
+ "assisted": null,
309
+ "order_quantity": null,
310
+ "post_engagement": null,
311
+ "post_view": null,
312
+ "sale_amount": null
313
+ },
314
+ "mobile_conversion_key_page_views": {
315
+ "post_engagement": null,
316
+ "post_view": null
317
+ },
318
+ "mobile_conversion_levels_achieved": {
319
+ "assisted": null,
320
+ "order_quantity": null,
321
+ "post_engagement": null,
322
+ "post_view": null,
323
+ "sale_amount": null
324
+ },
325
+ "mobile_conversion_lifetime_value_achievements_unlocked": {
326
+ "metric": null,
327
+ "order_quantity": null,
328
+ "sale_amount": null
329
+ },
330
+ "mobile_conversion_lifetime_value_add_to_carts": {
331
+ "metric": null,
332
+ "order_quantity": null,
333
+ "sale_amount": null
334
+ },
335
+ "mobile_conversion_lifetime_value_add_to_wishlists": {
336
+ "metric": null,
337
+ "order_quantity": null,
338
+ "sale_amount": null
339
+ },
340
+ "mobile_conversion_lifetime_value_checkouts_initiated": {
341
+ "metric": null,
342
+ "order_quantity": null,
343
+ "sale_amount": null
344
+ },
345
+ "mobile_conversion_lifetime_value_content_views": {
346
+ "metric": null,
347
+ "order_quantity": null,
348
+ "sale_amount": null
349
+ },
350
+ "mobile_conversion_lifetime_value_invites": {
351
+ "metric": null,
352
+ "order_quantity": null,
353
+ "sale_amount": null
354
+ },
355
+ "mobile_conversion_lifetime_value_levels_achieved": {
356
+ "metric": null,
357
+ "order_quantity": null,
358
+ "sale_amount": null
359
+ },
360
+ "mobile_conversion_lifetime_value_logins": {
361
+ "metric": [
362
+ 1,
363
+ 2,
364
+ 3,
365
+ 4,
366
+ 5,
367
+ 6,
368
+ 7,
369
+ 8
370
+ ],
371
+ "order_quantity": null,
372
+ "sale_amount": null
373
+ },
374
+ "mobile_conversion_lifetime_value_payment_info_additions": {
375
+ "metric": null,
376
+ "order_quantity": null,
377
+ "sale_amount": null
378
+ },
379
+ "mobile_conversion_lifetime_value_purchases": {
380
+ "metric": [
381
+ 1,
382
+ 2,
383
+ 3,
384
+ 4,
385
+ 5,
386
+ 6,
387
+ 7,
388
+ 8
389
+ ],
390
+ "order_quantity": null,
391
+ "sale_amount": [
392
+ 1,
393
+ 2,
394
+ 3,
395
+ 4,
396
+ 5,
397
+ 6,
398
+ 7,
399
+ 8
400
+ ]
401
+ },
402
+ "mobile_conversion_lifetime_value_rates": {
403
+ "metric": null,
404
+ "order_quantity": null,
405
+ "sale_amount": null
406
+ },
407
+ "mobile_conversion_lifetime_value_reservations": {
408
+ "metric": null,
409
+ "order_quantity": null,
410
+ "sale_amount": null
411
+ },
412
+ "mobile_conversion_lifetime_value_searches": {
413
+ "metric": null,
414
+ "order_quantity": null,
415
+ "sale_amount": null
416
+ },
417
+ "mobile_conversion_lifetime_value_shares": {
418
+ "metric": null,
419
+ "order_quantity": null,
420
+ "sale_amount": null
421
+ },
422
+ "mobile_conversion_lifetime_value_sign_ups": {
423
+ "metric": null,
424
+ "order_quantity": null,
425
+ "sale_amount": null
426
+ },
427
+ "mobile_conversion_lifetime_value_spent_credits": {
428
+ "metric": null,
429
+ "order_quantity": null,
430
+ "sale_amount": null
431
+ },
432
+ "mobile_conversion_lifetime_value_tutorials_completed": {
433
+ "metric": null,
434
+ "order_quantity": null,
435
+ "sale_amount": null
436
+ },
437
+ "mobile_conversion_lifetime_value_updates": {
438
+ "metric": null,
439
+ "order_quantity": null,
440
+ "sale_amount": null
441
+ },
442
+ "mobile_conversion_logins": {
443
+ "assisted": [
444
+ 1,
445
+ 2,
446
+ 3,
447
+ 4,
448
+ 5,
449
+ 6,
450
+ 7,
451
+ 8
452
+ ],
453
+ "order_quantity": null,
454
+ "post_engagement": [
455
+ 1,
456
+ 2,
457
+ 3,
458
+ 4,
459
+ 5,
460
+ 6,
461
+ 7,
462
+ 8
463
+ ],
464
+ "post_view": null,
465
+ "sale_amount": null
466
+ },
467
+ "mobile_conversion_payment_info_additions": {
468
+ "assisted": null,
469
+ "order_quantity": null,
470
+ "post_engagement": null,
471
+ "post_view": null,
472
+ "sale_amount": null
473
+ },
474
+ "mobile_conversion_purchases": {
475
+ "assisted": [
476
+ 1,
477
+ 2,
478
+ 3,
479
+ 4,
480
+ 5,
481
+ 6,
482
+ 7,
483
+ 8
484
+ ],
485
+ "order_quantity": null,
486
+ "post_engagement": [
487
+ 1,
488
+ 2,
489
+ 3,
490
+ 4,
491
+ 5,
492
+ 6,
493
+ 7,
494
+ 8
495
+ ],
496
+ "post_view": null,
497
+ "sale_amount": [
498
+ 1,
499
+ 2,
500
+ 3,
501
+ 4,
502
+ 5,
503
+ 6,
504
+ 7,
505
+ 8
506
+ ]
507
+ },
508
+ "mobile_conversion_rates": {
509
+ "assisted": null,
510
+ "order_quantity": null,
511
+ "post_engagement": null,
512
+ "post_view": null,
513
+ "sale_amount": null
514
+ },
515
+ "mobile_conversion_re_engages": {
516
+ "assisted": [
517
+ 1,
518
+ 2,
519
+ 3,
520
+ 4,
521
+ 5,
522
+ 6,
523
+ 7,
524
+ 8
525
+ ],
526
+ "order_quantity": null,
527
+ "post_engagement": [
528
+ 1,
529
+ 2,
530
+ 3,
531
+ 4,
532
+ 5,
533
+ 6,
534
+ 7,
535
+ 8
536
+ ],
537
+ "post_view": null,
538
+ "sale_amount": null
539
+ },
540
+ "mobile_conversion_reservations": {
541
+ "assisted": null,
542
+ "order_quantity": null,
543
+ "post_engagement": null,
544
+ "post_view": null,
545
+ "sale_amount": null
546
+ },
547
+ "mobile_conversion_searches": {
548
+ "assisted": null,
549
+ "order_quantity": null,
550
+ "post_engagement": null,
551
+ "post_view": null,
552
+ "sale_amount": null
553
+ },
554
+ "mobile_conversion_shares": {
555
+ "assisted": null,
556
+ "order_quantity": null,
557
+ "post_engagement": null,
558
+ "post_view": null,
559
+ "sale_amount": null
560
+ },
561
+ "mobile_conversion_sign_ups": {
562
+ "assisted": null,
563
+ "order_quantity": null,
564
+ "post_engagement": null,
565
+ "post_view": null,
566
+ "sale_amount": null
567
+ },
568
+ "mobile_conversion_site_visits": {
569
+ "order_quantity": null,
570
+ "post_engagement": [
571
+ 1,
572
+ 2,
573
+ 3,
574
+ 4,
575
+ 5,
576
+ 6,
577
+ 7,
578
+ 8
579
+ ],
580
+ "post_view": null,
581
+ "sale_amount": null
582
+ },
583
+ "mobile_conversion_spent_credits": {
584
+ "assisted": null,
585
+ "order_quantity": null,
586
+ "post_engagement": null,
587
+ "post_view": null,
588
+ "sale_amount": null
589
+ },
590
+ "mobile_conversion_tutorials_completed": {
591
+ "assisted": null,
592
+ "order_quantity": null,
593
+ "post_engagement": null,
594
+ "post_view": null,
595
+ "sale_amount": null
596
+ },
597
+ "mobile_conversion_updates": {
598
+ "assisted": null,
599
+ "order_quantity": null,
600
+ "post_engagement": null,
601
+ "post_view": null,
602
+ "sale_amount": null
603
+ },
604
+ "poll_card_vote": null,
605
+ "qualified_impressions": null,
606
+ "replies": [
607
+ 1,
608
+ 2,
609
+ 3,
610
+ 4,
611
+ 5,
612
+ 6,
613
+ 7,
614
+ 8
615
+ ],
616
+ "retweets": [
617
+ 1,
618
+ 2,
619
+ 3,
620
+ 4,
621
+ 5,
622
+ 6,
623
+ 7,
624
+ 8
625
+ ],
626
+ "tweets_send": [
627
+ 1,
628
+ 2,
629
+ 3,
630
+ 4,
631
+ 5,
632
+ 6,
633
+ 7,
634
+ 8
635
+ ],
636
+ "url_clicks": [
637
+ 1,
638
+ 2,
639
+ 3,
640
+ 4,
641
+ 5,
642
+ 6,
643
+ 7,
644
+ 8
645
+ ],
646
+ "video_3s100pct_views": [
647
+ 1,
648
+ 2,
649
+ 3,
650
+ 4,
651
+ 5,
652
+ 6,
653
+ 7,
654
+ 8
655
+ ],
656
+ "video_content_starts": [
657
+ 1,
658
+ 2,
659
+ 3,
660
+ 4,
661
+ 5,
662
+ 6,
663
+ 7,
664
+ 8
665
+ ],
666
+ "video_cta_clicks": null,
667
+ "video_mrc_views": [
668
+ 1,
669
+ 2,
670
+ 3,
671
+ 4,
672
+ 5,
673
+ 6,
674
+ 7,
675
+ 8
676
+ ],
677
+ "video_total_views": [
678
+ 1,
679
+ 2,
680
+ 3,
681
+ 4,
682
+ 5,
683
+ 6,
684
+ 7,
685
+ 8
686
+ ],
687
+ "video_views_100": [
688
+ 1,
689
+ 2,
690
+ 3,
691
+ 4,
692
+ 5,
693
+ 6,
694
+ 7,
695
+ 8
696
+ ],
697
+ "video_views_25": [
698
+ 1,
699
+ 2,
700
+ 3,
701
+ 4,
702
+ 5,
703
+ 6,
704
+ 7,
705
+ 8
706
+ ],
707
+ "video_views_50": [
708
+ 1,
709
+ 2,
710
+ 3,
711
+ 4,
712
+ 5,
713
+ 6,
714
+ 7,
715
+ 8
716
+ ],
717
+ "video_views_75": [
718
+ 1,
719
+ 2,
720
+ 3,
721
+ 4,
722
+ 5,
723
+ 6,
724
+ 7,
725
+ 8
726
+ ]
727
+ },
728
+ "segment": null
729
+ }
730
+ ]
731
+ }
732
+ ],
733
+ "data_type": "stats",
734
+ "request": {
735
+ "params": {
736
+ "country": null,
737
+ "end_time": "2017-08-28T15:00:00Z",
738
+ "entity": "CAMPAIGN",
739
+ "entity_ids": [
740
+ "xxxxx"
741
+ ],
742
+ "granularity": "DAY",
743
+ "metric_groups": [
744
+ "BILLING",
745
+ "ENGAGEMENT",
746
+ "LIFE_TIME_VALUE_MOBILE_CONVERSION",
747
+ "MEDIA",
748
+ "MOBILE_CONVERSION",
749
+ "VIDEO",
750
+ "WEB_CONVERSION"
751
+ ],
752
+ "placement": "ALL_ON_TWITTER",
753
+ "platform": null,
754
+ "segmentation_type": null,
755
+ "start_time": "2017-08-20T15:00:00Z"
756
+ }
757
+ },
758
+ "time_series_length": 8
759
+ }