Class: Zernio::ConversionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/conversions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ConversionsApi

Returns a new instance of ConversionsApi.



19
20
21
# File 'lib/zernio-sdk/api/conversions_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/conversions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_conversion_associations(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ AddConversionAssociations200Response

Associate campaigns Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).

Parameters:

  • account_id (String)
  • destination_id (String)
  • add_conversion_associations_request (AddConversionAssociationsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



29
30
31
32
# File 'lib/zernio-sdk/api/conversions_api.rb', line 29

def add_conversion_associations(, destination_id, add_conversion_associations_request, opts = {})
  data, _status_code, _headers = add_conversion_associations_with_http_info(, destination_id, add_conversion_associations_request, opts)
  data
end

#add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ Array<(AddConversionAssociations200Response, Integer, Hash)>

Associate campaigns Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).

Parameters:

  • account_id (String)
  • destination_id (String)
  • add_conversion_associations_request (AddConversionAssociationsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/zernio-sdk/api/conversions_api.rb', line 41

def add_conversion_associations_with_http_info(, destination_id, add_conversion_associations_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.add_conversion_associations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.add_conversion_associations"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.add_conversion_associations"
  end
  # verify the required parameter 'add_conversion_associations_request' is set
  if @api_client.config.client_side_validation && add_conversion_associations_request.nil?
    fail ArgumentError, "Missing the required parameter 'add_conversion_associations_request' when calling ConversionsApi.add_conversion_associations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(add_conversion_associations_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AddConversionAssociations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.add_conversion_associations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#add_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#adjust_conversions(adjust_conversions_request, opts = {}) ⇒ AdjustConversions200Response

Adjust uploaded conversions Adjust conversions that were previously uploaded via POST /v1/ads/conversions — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. Google Ads only. Google handles adjustments through the classic Google Ads API (ConversionAdjustmentUploadService); the Data Manager ingestEvents path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns 405 for those platforms. Adjustment types: - RETRACTION — remove the conversion entirely (refund, chargeback, cancelled order, churn). - RESTATEMENT — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected total value in restatementValue (not a delta). - ENHANCEMENT — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - orderId — the transaction ID you sent as eventId on the original conversion. Recommended, and required for ENHANCEMENT. - or gclid + conversionTime — the click ID and the original conversion's time (unix seconds). Not available for ENHANCEMENT. destinationId is the conversion action resource name, e.g. customers/1234567890/conversionActions/987654321 (same value you send to POST /v1/ads/conversions). PII in user is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required yyyy-MM-dd HH:mm:ss+00:00 format. Up to 2000 adjustments per request; partial failure is supported (inspect adjustmentsFailed / failures[]).

Parameters:

Returns:



107
108
109
110
# File 'lib/zernio-sdk/api/conversions_api.rb', line 107

def adjust_conversions(adjust_conversions_request, opts = {})
  data, _status_code, _headers = adjust_conversions_with_http_info(adjust_conversions_request, opts)
  data
end

#adjust_conversions_with_http_info(adjust_conversions_request, opts = {}) ⇒ Array<(AdjustConversions200Response, Integer, Hash)>

Adjust uploaded conversions Adjust conversions that were previously uploaded via `POST /v1/ads/conversions` — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. Google Ads only. Google handles adjustments through the classic Google Ads API (`ConversionAdjustmentUploadService`); the Data Manager `ingestEvents` path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns `405` for those platforms. Adjustment types: - `RETRACTION` — remove the conversion entirely (refund, chargeback, cancelled order, churn). - `RESTATEMENT` — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected total value in `restatementValue` (not a delta). - `ENHANCEMENT` — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - `orderId` — the transaction ID you sent as `eventId` on the original conversion. Recommended, and required for `ENHANCEMENT`. - or `gclid` + `conversionTime` — the click ID and the original conversion's time (unix seconds). Not available for `ENHANCEMENT`. `destinationId` is the conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` (same value you send to `POST /v1/ads/conversions`). PII in `user` is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required `yyyy-MM-dd HH:mm:ss+00:00` format. Up to 2000 adjustments per request; partial failure is supported (inspect `adjustmentsFailed` / `failures`).

Parameters:

Returns:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/zernio-sdk/api/conversions_api.rb', line 117

def adjust_conversions_with_http_info(adjust_conversions_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.adjust_conversions ...'
  end
  # verify the required parameter 'adjust_conversions_request' is set
  if @api_client.config.client_side_validation && adjust_conversions_request.nil?
    fail ArgumentError, "Missing the required parameter 'adjust_conversions_request' when calling ConversionsApi.adjust_conversions"
  end
  # resource path
  local_var_path = '/v1/ads/conversions/adjustments'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(adjust_conversions_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AdjustConversions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.adjust_conversions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#adjust_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_conversion_destination(account_id, create_conversion_destination_request, opts = {}) ⇒ CreateConversionDestination201Response

Create a conversion destination Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta and OpenAI Ads pixels are created via their own tracking-tags flow instead (POST /v1/accounts/{accountId}/tracking-tags); this endpoint returns 405 for both. LinkedIn: creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. Google Ads: calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed IDEMPOTENCY_CONFLICT (409) rather than silently returning the mismatched action. LinkedIn: the rule is created with conversionMethod=CONVERSIONS_API and (by default) auto-associated with all of the ad account's campaigns via autoAssociationType=ALL_CAMPAIGNS. Pass autoAssociationType: NONE to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for SUBMIT_APPLICATION, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, and LEAD rule types; the API rejects other combinations locally. Google Ads: the conversion action is created with type=UPLOAD_CLICKS (required for API-uploaded offline conversions, immutable after creation). The type field carries the Google ConversionActionCategory enum value, e.g. PURCHASE, SUBSCRIBE_PAID, SIGNUP, IMPORTED_LEAD, BOOK_APPOINTMENT. Unified standard event names (e.g. Purchase, Subscribe, CompleteRegistration, Lead, Schedule) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass primaryForGoal: true to opt in.

Parameters:

  • account_id (String)

    SocialAccount ID (linkedinads or googleads).

  • create_conversion_destination_request (CreateConversionDestinationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



176
177
178
179
# File 'lib/zernio-sdk/api/conversions_api.rb', line 176

def create_conversion_destination(, create_conversion_destination_request, opts = {})
  data, _status_code, _headers = create_conversion_destination_with_http_info(, create_conversion_destination_request, opts)
  data
end

#create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts = {}) ⇒ Array<(CreateConversionDestination201Response, Integer, Hash)>

Create a conversion destination Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta and OpenAI Ads pixels are created via their own tracking-tags flow instead (`POST /v1/accounts/accountId/tracking-tags`); this endpoint returns 405 for both. LinkedIn: creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. Google Ads: calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed `IDEMPOTENCY_CONFLICT` (409) rather than silently returning the mismatched action. LinkedIn: the rule is created with `conversionMethod=CONVERSIONS_API` and (by default) auto-associated with all of the ad account's campaigns via `autoAssociationType=ALL_CAMPAIGNS`. Pass `autoAssociationType: NONE` to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for `SUBMIT_APPLICATION`, `PURCHASE`, `ADD_TO_CART`, `QUALIFIED_LEAD`, and `LEAD` rule types; the API rejects other combinations locally. Google Ads: the conversion action is created with `type=UPLOAD_CLICKS` (required for API-uploaded offline conversions, immutable after creation). The `type` field carries the Google `ConversionActionCategory` enum value, e.g. `PURCHASE`, `SUBSCRIBE_PAID`, `SIGNUP`, `IMPORTED_LEAD`, `BOOK_APPOINTMENT`. Unified standard event names (e.g. `Purchase`, `Subscribe`, `CompleteRegistration`, `Lead`, `Schedule`) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass `primaryForGoal: true` to opt in.

Parameters:

  • account_id (String)

    SocialAccount ID (linkedinads or googleads).

  • create_conversion_destination_request (CreateConversionDestinationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/zernio-sdk/api/conversions_api.rb', line 187

def create_conversion_destination_with_http_info(, create_conversion_destination_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.create_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.create_conversion_destination"
  end
  # verify the required parameter 'create_conversion_destination_request' is set
  if @api_client.config.client_side_validation && create_conversion_destination_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_conversion_destination_request' when calling ConversionsApi.create_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_conversion_destination_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateConversionDestination201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.create_conversion_destination",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#create_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_conversion_destination(account_id, destination_id, opts = {}) ⇒ nil

Delete a conversion destination LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls "delete" is the same enabled: false flip we apply here. The rule remains fetchable via GET with status: 'inactive'; the unified discovery endpoint hides it by default. adAccountId may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.

Parameters:

  • account_id (String)
  • destination_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Required as query OR in JSON body.

Returns:

  • (nil)


251
252
253
254
# File 'lib/zernio-sdk/api/conversions_api.rb', line 251

def delete_conversion_destination(, destination_id, opts = {})
  delete_conversion_destination_with_http_info(, destination_id, opts)
  nil
end

#delete_conversion_destination_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a conversion destination LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls &quot;delete&quot; is the same `enabled: false` flip we apply here. The rule remains fetchable via GET with `status: 'inactive'`; the unified discovery endpoint hides it by default. `adAccountId` may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.

Parameters:

  • account_id (String)
  • destination_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Required as query OR in JSON body.

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/zernio-sdk/api/conversions_api.rb', line 263

def delete_conversion_destination_with_http_info(, destination_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.delete_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.delete_conversion_destination"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.delete_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.delete_conversion_destination",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#delete_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_conversion_destination(account_id, destination_id, ad_account_id, opts = {}) ⇒ GetConversionDestination200Response

Get a conversion destination LinkedIn-only today. Returns the full destination record for one conversion rule. The adAccountId query parameter is required because LinkedIn rules are scoped to a sponsored ad account.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)

    Numeric ID or full `urn:li:sponsoredAccount:id` URN.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



323
324
325
326
# File 'lib/zernio-sdk/api/conversions_api.rb', line 323

def get_conversion_destination(, destination_id, , opts = {})
  data, _status_code, _headers = get_conversion_destination_with_http_info(, destination_id, , opts)
  data
end

#get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>

Get a conversion destination LinkedIn-only today. Returns the full destination record for one conversion rule. The `adAccountId` query parameter is required because LinkedIn rules are scoped to a sponsored ad account.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)

    Numeric ID or full `urn:li:sponsoredAccount:id` URN.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/zernio-sdk/api/conversions_api.rb', line 335

def get_conversion_destination_with_http_info(, destination_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.get_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.get_conversion_destination"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.get_conversion_destination"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.get_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionDestination200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.get_conversion_destination",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#get_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_conversion_metrics(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ GetConversionMetrics200Response

Get attribution metrics LinkedIn-only today. Returns conversion-attribution metrics (externalWebsiteConversions, externalWebsitePostClickConversions, externalWebsitePostViewConversions, conversionValueInLocalCurrency, qualifiedLeads, costInLocalCurrency) bucketed by date. Date-range constraints (passed through from LinkedIn): - granularity=DAILY is retained for ~6 months only - granularity=ALL with a range > 6 months auto-rounds to month boundaries - granularity=MONTHLY/YEARLY retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • start_date (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :end_date (String)
  • :granularity (String) — default: default to 'DAILY'

Returns:



402
403
404
405
# File 'lib/zernio-sdk/api/conversions_api.rb', line 402

def get_conversion_metrics(, destination_id, , start_date, opts = {})
  data, _status_code, _headers = get_conversion_metrics_with_http_info(, destination_id, , start_date, opts)
  data
end

#get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ Array<(GetConversionMetrics200Response, Integer, Hash)>

Get attribution metrics LinkedIn-only today. Returns conversion-attribution metrics (`externalWebsiteConversions`, `externalWebsitePostClickConversions`, `externalWebsitePostViewConversions`, `conversionValueInLocalCurrency`, `qualifiedLeads`, `costInLocalCurrency`) bucketed by date. Date-range constraints (passed through from LinkedIn): - `granularity=DAILY` is retained for ~6 months only - `granularity=ALL` with a range > 6 months auto-rounds to month boundaries - `granularity=MONTHLY`/`YEARLY` retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • start_date (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :end_date (String)
  • :granularity (String) — default: default to 'DAILY'

Returns:



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/zernio-sdk/api/conversions_api.rb', line 417

def get_conversion_metrics_with_http_info(, destination_id, , start_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.get_conversion_metrics ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.get_conversion_metrics"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.get_conversion_metrics"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.get_conversion_metrics"
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling ConversionsApi.get_conversion_metrics"
  end
  pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/)
  if @api_client.config.client_side_validation && start_date !~ pattern
    fail ArgumentError, "invalid value for 'start_date' when calling ConversionsApi.get_conversion_metrics, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/)
  if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling ConversionsApi.get_conversion_metrics, must conform to the pattern #{pattern}."
  end

  allowable_values = ["ALL", "DAILY", "MONTHLY", "YEARLY"]
  if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])
    fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/metrics'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = 
  query_params[:'startDate'] = start_date
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionMetrics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.get_conversion_metrics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#get_conversion_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_conversions_quality(account_id, destination_id, opts = {}) ⇒ GetConversionsQuality200Response

Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.

Parameters:

  • account_id (String)

    SocialAccount _id (must be a metaads account).

  • destination_id (String)

    Meta pixel/dataset ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



501
502
503
504
# File 'lib/zernio-sdk/api/conversions_api.rb', line 501

def get_conversions_quality(, destination_id, opts = {})
  data, _status_code, _headers = get_conversions_quality_with_http_info(, destination_id, opts)
  data
end

#get_conversions_quality_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(GetConversionsQuality200Response, Integer, Hash)>

Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.

Parameters:

  • account_id (String)

    SocialAccount _id (must be a metaads account).

  • destination_id (String)

    Meta pixel/dataset ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/zernio-sdk/api/conversions_api.rb', line 512

def get_conversions_quality_with_http_info(, destination_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.get_conversions_quality ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.get_conversions_quality"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.get_conversions_quality"
  end
  # resource path
  local_var_path = '/v1/ads/conversions/quality'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'destinationId'] = destination_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionsQuality200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.get_conversions_quality",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#get_conversions_quality\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_conversion_associations(account_id, destination_id, ad_account_id, opts = {}) ⇒ ListConversionAssociations200Response

List associated campaigns LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



573
574
575
576
# File 'lib/zernio-sdk/api/conversions_api.rb', line 573

def list_conversion_associations(, destination_id, , opts = {})
  data, _status_code, _headers = list_conversion_associations_with_http_info(, destination_id, , opts)
  data
end

#list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(ListConversionAssociations200Response, Integer, Hash)>

List associated campaigns LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/zernio-sdk/api/conversions_api.rb', line 585

def list_conversion_associations_with_http_info(, destination_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.list_conversion_associations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.list_conversion_associations"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.list_conversion_associations"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.list_conversion_associations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListConversionAssociations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.list_conversion_associations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#list_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_conversion_destinations(account_id, opts = {}) ⇒ ListConversionDestinations200Response

List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), conversion rules (LinkedIn), or pixels (OpenAI Ads) accessible to the connected ads account. Use the returned id as destinationId when posting to POST /v1/ads/conversions. For Google and LinkedIn, each destination's type reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta and OpenAI Ads, type is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the adAccountId field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).

Parameters:

  • account_id (String)

    SocialAccount ID (metaads, googleads, linkedinads, tiktokads, or openaiads).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



647
648
649
650
# File 'lib/zernio-sdk/api/conversions_api.rb', line 647

def list_conversion_destinations(, opts = {})
  data, _status_code, _headers = list_conversion_destinations_with_http_info(, opts)
  data
end

#list_conversion_destinations_with_http_info(account_id, opts = {}) ⇒ Array<(ListConversionDestinations200Response, Integer, Hash)>

List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), conversion rules (LinkedIn), or pixels (OpenAI Ads) accessible to the connected ads account. Use the returned `id` as `destinationId` when posting to `POST /v1/ads/conversions`. For Google and LinkedIn, each destination's `type` reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta and OpenAI Ads, `type` is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the `adAccountId` field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).

Parameters:

  • account_id (String)

    SocialAccount ID (metaads, googleads, linkedinads, tiktokads, or openaiads).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# File 'lib/zernio-sdk/api/conversions_api.rb', line 657

def list_conversion_destinations_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.list_conversion_destinations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.list_conversion_destinations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListConversionDestinations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.list_conversion_destinations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#list_conversion_destinations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_conversion_associations(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ RemoveConversionAssociations200Response

Remove associated campaigns Remove one or more campaign associations from this conversion rule. Pass adAccountId and campaignIds as query parameters (campaignIds is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • campaign_ids (String)

    Comma-separated list of campaign IDs.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



713
714
715
716
# File 'lib/zernio-sdk/api/conversions_api.rb', line 713

def remove_conversion_associations(, destination_id, , campaign_ids, opts = {})
  data, _status_code, _headers = remove_conversion_associations_with_http_info(, destination_id, , campaign_ids, opts)
  data
end

#remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ Array<(RemoveConversionAssociations200Response, Integer, Hash)>

Remove associated campaigns Remove one or more campaign associations from this conversion rule. Pass `adAccountId` and `campaignIds` as query parameters (`campaignIds` is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.

Parameters:

  • account_id (String)
  • destination_id (String)
  • ad_account_id (String)
  • campaign_ids (String)

    Comma-separated list of campaign IDs.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
# File 'lib/zernio-sdk/api/conversions_api.rb', line 726

def remove_conversion_associations_with_http_info(, destination_id, , campaign_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.remove_conversion_associations ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.remove_conversion_associations"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.remove_conversion_associations"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.remove_conversion_associations"
  end
  # verify the required parameter 'campaign_ids' is set
  if @api_client.config.client_side_validation && campaign_ids.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_ids' when calling ConversionsApi.remove_conversion_associations"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'adAccountId'] = 
  query_params[:'campaignIds'] = campaign_ids

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RemoveConversionAssociations200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.remove_conversion_associations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#remove_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_conversions(send_conversions_request, opts = {}) ⇒ SendConversions200Response

Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided accountId. Requires the Ads add-on. Supported platforms: - Meta (metaads) via Graph API - Google Ads (googleads) via Data Manager API ingestEvents - LinkedIn (linkedinads) via /rest/conversionEvents - TikTok (tiktokads) via the Offline Events API /offline/batch/ — OFFLINE conversions only - OpenAI Ads (openaiads) via its Conversions API (a separate host, bzr.openai.com) destinationId semantics differ per platform: - Meta: pixel (dataset) ID, e.g. 123456789012345 - Google: conversion action resource name, e.g. customers/1234567890/conversionActions/987654321 - LinkedIn: conversion rule ID or URN, e.g. 104012 or urn:lla:llaPartnerConversion:104012 - TikTok: Offline Event Set ID, e.g. 7057103914977558530 - OpenAI Ads: pixel wire id (numeric pixel_id, distinct from the internal pixel id), as returned by GET /v1/accounts/{accountId}/conversion-destinations TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. OpenAI Ads notes: requires a tracking tag (pixel) to already exist on the account — returns 422 with code TRACKING_TAG_REQUIRED if POST /v1/accounts/{accountId}/tracking-tags hasn't been called yet. Callers can list valid destinations via GET /v1/accounts/{accountId}/conversion-destinations. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn externalIds are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include rw_conversions). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. OpenAI Ads caps at 1000 per request; larger submissions are split into 1000-event chunks, each all-or-nothing (a malformed event fails every event in that chunk, not the whole request). Dedup: pass a stable eventId on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to transactionId. Per-platform eventName semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's type (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it. - OpenAI Ads: a fixed subset of standard names (Purchase, Lead, AddToCart, ViewContent, InitiateCheckout, CompleteRegistration, Subscribe, StartTrial, Schedule) maps 1:1 onto OpenAI's own event-type enum; any other standard name or custom string is sent as type: custom with the name preserved.

Parameters:

Returns:



793
794
795
796
# File 'lib/zernio-sdk/api/conversions_api.rb', line 793

def send_conversions(send_conversions_request, opts = {})
  data, _status_code, _headers = send_conversions_with_http_info(send_conversions_request, opts)
  data
end

#send_conversions_with_http_info(send_conversions_request, opts = {}) ⇒ Array<(SendConversions200Response, Integer, Hash)>

Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided `accountId`. Requires the Ads add-on. Supported platforms: - Meta (`metaads`) via Graph API - Google Ads (`googleads`) via Data Manager API `ingestEvents` - LinkedIn (`linkedinads`) via `/rest/conversionEvents` - TikTok (`tiktokads`) via the Offline Events API `/offline/batch/` — OFFLINE conversions only - OpenAI Ads (`openaiads`) via its Conversions API (a separate host, `bzr.openai.com`) `destinationId` semantics differ per platform: - Meta: pixel (dataset) ID, e.g. `123456789012345` - Google: conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` - LinkedIn: conversion rule ID or URN, e.g. `104012` or `urn:lla:llaPartnerConversion:104012` - TikTok: Offline Event Set ID, e.g. `7057103914977558530` - OpenAI Ads: pixel wire id (numeric `pixel_id`, distinct from the internal pixel id), as returned by `GET /v1/accounts/accountId/conversion-destinations` TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. OpenAI Ads notes: requires a tracking tag (pixel) to already exist on the account — returns 422 with code `TRACKING_TAG_REQUIRED` if `POST /v1/accounts/accountId/tracking-tags` hasn't been called yet. Callers can list valid destinations via `GET /v1/accounts/accountId/conversion-destinations`. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn `externalIds` are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include `rw_conversions`). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. OpenAI Ads caps at 1000 per request; larger submissions are split into 1000-event chunks, each all-or-nothing (a malformed event fails every event in that chunk, not the whole request). Dedup: pass a stable `eventId` on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to `transactionId`. Per-platform `eventName` semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's `type` (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it. - OpenAI Ads: a fixed subset of standard names (Purchase, Lead, AddToCart, ViewContent, InitiateCheckout, CompleteRegistration, Subscribe, StartTrial, Schedule) maps 1:1 onto OpenAI's own event-type enum; any other standard name or custom string is sent as `type: custom` with the name preserved.

Parameters:

Returns:

  • (Array<(SendConversions200Response, Integer, Hash)>)

    SendConversions200Response data, response status code and response headers



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
# File 'lib/zernio-sdk/api/conversions_api.rb', line 803

def send_conversions_with_http_info(send_conversions_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.send_conversions ...'
  end
  # verify the required parameter 'send_conversions_request' is set
  if @api_client.config.client_side_validation && send_conversions_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_conversions_request' when calling ConversionsApi.send_conversions"
  end
  # resource path
  local_var_path = '/v1/ads/conversions'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_conversions_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendConversions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.send_conversions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#send_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_conversion_destination(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ GetConversionDestination200Response

Update a conversion destination Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: name, enabled, attribution windows, valueType, value, attributionType. The rule's type and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.

Parameters:

  • account_id (String)
  • destination_id (String)
  • update_conversion_destination_request (UpdateConversionDestinationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



863
864
865
866
# File 'lib/zernio-sdk/api/conversions_api.rb', line 863

def update_conversion_destination(, destination_id, update_conversion_destination_request, opts = {})
  data, _status_code, _headers = update_conversion_destination_with_http_info(, destination_id, update_conversion_destination_request, opts)
  data
end

#update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>

Update a conversion destination Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: `name`, `enabled`, attribution windows, `valueType`, `value`, `attributionType`. The rule's `type` and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.

Parameters:

  • account_id (String)
  • destination_id (String)
  • update_conversion_destination_request (UpdateConversionDestinationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
# File 'lib/zernio-sdk/api/conversions_api.rb', line 875

def update_conversion_destination_with_http_info(, destination_id, update_conversion_destination_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConversionsApi.update_conversion_destination ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.update_conversion_destination"
  end
  # verify the required parameter 'destination_id' is set
  if @api_client.config.client_side_validation && destination_id.nil?
    fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.update_conversion_destination"
  end
  # verify the required parameter 'update_conversion_destination_request' is set
  if @api_client.config.client_side_validation && update_conversion_destination_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_conversion_destination_request' when calling ConversionsApi.update_conversion_destination"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_conversion_destination_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetConversionDestination200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ConversionsApi.update_conversion_destination",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversionsApi#update_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end