-
Notifications
You must be signed in to change notification settings - Fork 4
/
conversions.clj
113 lines (101 loc) · 3.69 KB
/
conversions.clj
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
113
(ns happygapi.dfareporting.conversions
"DCM/DFA Reporting And Trafficking API: conversions.
Manages your DoubleClick Campaign Manager ad campaigns and reports.
See: https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/conversions"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn batchinsert$
"https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/conversions/batchinsert
Required parameters: profileId
Optional parameters: none
Body:
{:conversions [{:encryptedUserId string,
:childDirectedTreatment boolean,
:treatmentForUnderage boolean,
:floodlightConfigurationId string,
:nonPersonalizedAd boolean,
:value number,
:ordinal string,
:encryptedUserIdCandidates [string],
:kind string,
:timestampMicros string,
:mobileDeviceId string,
:limitAdTracking boolean,
:matchId string,
:customVariables [CustomFloodlightVariable],
:quantity string,
:gclid string,
:floodlightActivityId string}],
:encryptionInfo {:encryptionEntityId string,
:encryptionEntityType string,
:encryptionSource string,
:kind string},
:kind string}
Inserts conversions."
{:scopes ["https://www.googleapis.com/auth/ddmconversions"]}
[auth args body]
{:pre [(util/has-keys? args #{:profileId})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/dfareporting/v3.4/"
"userprofiles/{profileId}/conversions/batchinsert"
#{:profileId}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn batchupdate$
"https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/conversions/batchupdate
Required parameters: profileId
Optional parameters: none
Body:
{:conversions [{:encryptedUserId string,
:childDirectedTreatment boolean,
:treatmentForUnderage boolean,
:floodlightConfigurationId string,
:nonPersonalizedAd boolean,
:value number,
:ordinal string,
:encryptedUserIdCandidates [string],
:kind string,
:timestampMicros string,
:mobileDeviceId string,
:limitAdTracking boolean,
:matchId string,
:customVariables [CustomFloodlightVariable],
:quantity string,
:gclid string,
:floodlightActivityId string}],
:encryptionInfo {:encryptionEntityId string,
:encryptionEntityType string,
:encryptionSource string,
:kind string},
:kind string}
Updates existing conversions."
{:scopes ["https://www.googleapis.com/auth/ddmconversions"]}
[auth args body]
{:pre [(util/has-keys? args #{:profileId})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/dfareporting/v3.4/"
"userprofiles/{profileId}/conversions/batchupdate"
#{:profileId}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))