Class: Zernio::TrackingTagsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TrackingTagsApi

Returns a new instance of TrackingTagsApi.



19
20
21
# File 'lib/zernio-sdk/api/tracking_tags_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/tracking_tags_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_tracking_tag_shared_account(account_id, tag_id, add_tracking_tag_shared_account_request, opts = {}) ⇒ AddTrackingTagSharedAccount201Response

Share with an ad account Shares the pixel with another ad account so campaigns/audiences in that account can use it. Requires that you administer both the pixel's owning Business Manager and the target ad account; a pixel on a personal (non-BM) ad account can't be shared (Meta will reject the call). Meta only (platform metaads); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



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

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

#add_tracking_tag_shared_account_with_http_info(account_id, tag_id, add_tracking_tag_shared_account_request, opts = {}) ⇒ Array<(AddTrackingTagSharedAccount201Response, Integer, Hash)>

Share with an ad account Shares the pixel with another ad account so campaigns/audiences in that account can use it. Requires that you administer both the pixel's owning Business Manager and the target ad account; a pixel on a personal (non-BM) ad account can't be shared (Meta will reject the call). Meta only (platform `metaads`); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

  • add_tracking_tag_shared_account_request (AddTrackingTagSharedAccountRequest)
  • 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/tracking_tags_api.rb', line 41

def (, tag_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.add_tracking_tag_shared_account ...'
  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 TrackingTagsApi.add_tracking_tag_shared_account"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling TrackingTagsApi.add_tracking_tag_shared_account"
  end
  # verify the required parameter 'add_tracking_tag_shared_account_request' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'add_tracking_tag_shared_account_request' when calling TrackingTagsApi.add_tracking_tag_shared_account"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags/{tagId}/shared-accounts'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_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()

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

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.add_tracking_tag_shared_account",
    :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: TrackingTagsApi#add_tracking_tag_shared_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_tracking_tag(account_id, create_tracking_tag_request, opts = {}) ⇒ CreateTrackingTag201Response

Create a tracking tag Meta: creates a Meta Pixel on the given ad account (POST /act_{id}/adspixelsname is the only input). Returns the created tag including its install code. The pixel is owned by the Business Manager that owns the ad account; a pixel created on a personal (non-BM) ad account ends up with ownerBusinessId: null and can't be shared with other ad accounts. Creating a Meta pixel does NOT install it — install the returned code snippet on the site, or send events server-side via POST /v1/ads/conversions. The check installed is derived from lastFiredTime. OpenAI Ads: creates an OpenAI pixel AND provisions a Conversions API key for it in the same call (adAccountId is required by this endpoint but ignored — one API key maps to exactly one ad account, so there's nothing to select). Returns 422 (FEATURE_NOT_AVAILABLE) if the ad account isn't enabled for pixel management; contact your OpenAI partner representative to enable it. There is no delete API for OpenAI pixels. If the pixel is created but the Conversions API key provisioning then fails, the pixel is left live on OpenAI (it cannot be cleaned up) and the error message names the surviving pixel id and warns against retrying, since a retry would create a second, orphaned pixel. NOT idempotent on either platform: each call creates a new pixel (and, for OpenAI, a new Conversions API key). Do not retry blindly on timeout. Meta (platform metaads) and OpenAI Ads (platform openaiads); other platforms return 405.

Parameters:

  • account_id (String)

    Ads SocialAccount id (platform `metaads` or `openaiads`).

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

    the optional parameters

Returns:



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

def create_tracking_tag(, create_tracking_tag_request, opts = {})
  data, _status_code, _headers = create_tracking_tag_with_http_info(, create_tracking_tag_request, opts)
  data
end

#create_tracking_tag_with_http_info(account_id, create_tracking_tag_request, opts = {}) ⇒ Array<(CreateTrackingTag201Response, Integer, Hash)>

Create a tracking tag Meta: creates a Meta Pixel on the given ad account (`POST /act_id/adspixels` — `name` is the only input). Returns the created tag including its install `code`. The pixel is owned by the Business Manager that owns the ad account; a pixel created on a personal (non-BM) ad account ends up with `ownerBusinessId: null` and can't be shared with other ad accounts. Creating a Meta pixel does NOT install it — install the returned `code` snippet on the site, or send events server-side via `POST /v1/ads/conversions`. The check `installed` is derived from `lastFiredTime`. OpenAI Ads: creates an OpenAI pixel AND provisions a Conversions API key for it in the same call (`adAccountId` is required by this endpoint but ignored — one API key maps to exactly one ad account, so there's nothing to select). Returns 422 (`FEATURE_NOT_AVAILABLE`) if the ad account isn't enabled for pixel management; contact your OpenAI partner representative to enable it. There is no delete API for OpenAI pixels. If the pixel is created but the Conversions API key provisioning then fails, the pixel is left live on OpenAI (it cannot be cleaned up) and the error message names the surviving pixel id and warns against retrying, since a retry would create a second, orphaned pixel. NOT idempotent on either platform: each call creates a new pixel (and, for OpenAI, a new Conversions API key). Do not retry blindly on timeout. Meta (platform `metaads`) and OpenAI Ads (platform `openaiads`); other platforms return 405.

Parameters:

  • account_id (String)

    Ads SocialAccount id (platform `metaads` or `openaiads`).

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

    the optional parameters

Returns:



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
169
170
171
172
173
174
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 119

def create_tracking_tag_with_http_info(, create_tracking_tag_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.create_tracking_tag ...'
  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 TrackingTagsApi.create_tracking_tag"
  end
  # verify the required parameter 'create_tracking_tag_request' is set
  if @api_client.config.client_side_validation && create_tracking_tag_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_tracking_tag_request' when calling TrackingTagsApi.create_tracking_tag"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags'.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_tracking_tag_request)

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

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.create_tracking_tag",
    :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: TrackingTagsApi#create_tracking_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_tracking_tags(ad_id, opts = {}) ⇒ GetAdTrackingTags200Response

Get ad tracking tags Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's url_tags (and template_url_spec). - Google (googleads): the campaign's trackingUrlTemplate + finalUrlSuffix. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM dynamicValueParameters + customValueParameters. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).

Parameters:

  • ad_id (String)

    Ad id (hex _id, platformAdId, or effective story/media id).

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

    the optional parameters

Returns:



181
182
183
184
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 181

def get_ad_tracking_tags(ad_id, opts = {})
  data, _status_code, _headers = get_ad_tracking_tags_with_http_info(ad_id, opts)
  data
end

#get_ad_tracking_tags_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdTrackingTags200Response, Integer, Hash)>

Get ad tracking tags Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).

Parameters:

  • ad_id (String)

    Ad id (hex _id, platformAdId, or effective story/media id).

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

    the optional parameters

Returns:



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

def get_ad_tracking_tags_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.get_ad_tracking_tags ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling TrackingTagsApi.get_ad_tracking_tags"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/tracking-tags'.sub('{' + 'adId' + '}', CGI.escape(ad_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']

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.get_ad_tracking_tags",
    :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: TrackingTagsApi#get_ad_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tracking_tag(account_id, tag_id, opts = {}) ⇒ GetTrackingTag200Response

Get a tracking tag Returns the full tag record including the base-code code snippet, lastFiredTime, ownerBusinessId, isUnavailable, etc. Meta only (platform metaads); other platforms return 405. OpenAI Ads has no get-by-id endpoint, so it 405s here too — use GET /v1/accounts/{accountId}/tracking-tags (list) instead.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



245
246
247
248
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 245

def get_tracking_tag(, tag_id, opts = {})
  data, _status_code, _headers = get_tracking_tag_with_http_info(, tag_id, opts)
  data
end

#get_tracking_tag_stats(account_id, tag_id, opts = {}) ⇒ GetTrackingTagStats200Response

Get aggregated event stats Returns aggregated event counts for the pixel (GET /{pixel_id}/stats). Rows are passed through from Meta as-is — their shape depends on the aggregation requested. Meta only (platform metaads); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Options Hash (opts):

  • :aggregation (String)

    Aggregation dimension. Defaults to `event`. (default to 'event')

  • :start_time (Integer)

    Unix seconds lower bound.

  • :end_time (Integer)

    Unix seconds upper bound.

Returns:



317
318
319
320
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 317

def get_tracking_tag_stats(, tag_id, opts = {})
  data, _status_code, _headers = get_tracking_tag_stats_with_http_info(, tag_id, opts)
  data
end

#get_tracking_tag_stats_with_http_info(account_id, tag_id, opts = {}) ⇒ Array<(GetTrackingTagStats200Response, Integer, Hash)>

Get aggregated event stats Returns aggregated event counts for the pixel (`GET /pixel_id/stats`). Rows are passed through from Meta as-is — their shape depends on the `aggregation` requested. Meta only (platform `metaads`); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Options Hash (opts):

  • :aggregation (String)

    Aggregation dimension. Defaults to `event`. (default to 'event')

  • :start_time (Integer)

    Unix seconds lower bound.

  • :end_time (Integer)

    Unix seconds upper bound.

Returns:



331
332
333
334
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
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 331

def get_tracking_tag_stats_with_http_info(, tag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.get_tracking_tag_stats ...'
  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 TrackingTagsApi.get_tracking_tag_stats"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling TrackingTagsApi.get_tracking_tag_stats"
  end
  allowable_values = ["event", "host", "url", "url_by_rule", "pixel_fire", "device_type", "device_os", "browser_type", "had_pii", "custom_data_field", "match_keys", "event_source", "event_detection_method", "event_processing_results", "event_total_counts", "event_value_count"]
  if @api_client.config.client_side_validation && opts[:'aggregation'] && !allowable_values.include?(opts[:'aggregation'])
    fail ArgumentError, "invalid value for \"aggregation\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags/{tagId}/stats'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'aggregation'] = opts[:'aggregation'] if !opts[:'aggregation'].nil?
  query_params[:'startTime'] = opts[:'start_time'] if !opts[:'start_time'].nil?
  query_params[:'endTime'] = opts[:'end_time'] if !opts[:'end_time'].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] || 'GetTrackingTagStats200Response'

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.get_tracking_tag_stats",
    :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: TrackingTagsApi#get_tracking_tag_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tracking_tag_with_http_info(account_id, tag_id, opts = {}) ⇒ Array<(GetTrackingTag200Response, Integer, Hash)>

Get a tracking tag Returns the full tag record including the base-code `code` snippet, `lastFiredTime`, `ownerBusinessId`, `isUnavailable`, etc. Meta only (platform `metaads`); other platforms return 405. OpenAI Ads has no get-by-id endpoint, so it 405s here too — use `GET /v1/accounts/accountId/tracking-tags` (list) instead.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:

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

    GetTrackingTag200Response data, response status code and response headers



256
257
258
259
260
261
262
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
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 256

def get_tracking_tag_with_http_info(, tag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.get_tracking_tag ...'
  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 TrackingTagsApi.get_tracking_tag"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling TrackingTagsApi.get_tracking_tag"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags/{tagId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_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']

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.get_tracking_tag",
    :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: TrackingTagsApi#get_tracking_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_tracking_tag_shared_accounts(account_id, tag_id, opts = {}) ⇒ ListTrackingTagSharedAccounts200Response

List accounts it is shared with Meta only (platform metaads); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



396
397
398
399
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 396

def list_tracking_tag_shared_accounts(, tag_id, opts = {})
  data, _status_code, _headers = list_tracking_tag_shared_accounts_with_http_info(, tag_id, opts)
  data
end

#list_tracking_tag_shared_accounts_with_http_info(account_id, tag_id, opts = {}) ⇒ Array<(ListTrackingTagSharedAccounts200Response, Integer, Hash)>

List accounts it is shared with Meta only (platform `metaads`); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



407
408
409
410
411
412
413
414
415
416
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
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 407

def list_tracking_tag_shared_accounts_with_http_info(, tag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.list_tracking_tag_shared_accounts ...'
  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 TrackingTagsApi.list_tracking_tag_shared_accounts"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling TrackingTagsApi.list_tracking_tag_shared_accounts"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags/{tagId}/shared-accounts'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_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']

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.list_tracking_tag_shared_accounts",
    :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: TrackingTagsApi#list_tracking_tag_shared_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_tracking_tags(account_id, opts = {}) ⇒ ListTrackingTags200Response

List tracking tags Returns the tracking tags (Meta Pixels, or OpenAI Ads pixels) the connected ads account can see. Pass ?adAccountId=act_... (Meta only) to scope the list to a single ad account; omit it to list every pixel reachable by the token (the name is then suffixed with the ad account it was discovered on, for disambiguation). The list view omits code — call getTrackingTag for the install snippet and full detail (Meta only; OpenAI Ads has no get-by-id endpoint). Meta (platform metaads) and OpenAI Ads (platform openaiads); other platforms return 405. The accountId must be the ads SocialAccount created by the Ads add-on connect flow (Meta) or the OpenAI Ads connect flow, not a Facebook/Instagram posting account. Get your Meta act_... ids from GET /v1/ads/accounts; adAccountId is ignored for OpenAI Ads (one API key maps to exactly one ad account).

Parameters:

  • account_id (String)

    Ads SocialAccount id (platform `metaads` or `openaiads`).

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Optional, Meta only. Scope to one ad account, e.g. `act_123456789`. Ignored for OpenAI Ads.

Returns:



465
466
467
468
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 465

def list_tracking_tags(, opts = {})
  data, _status_code, _headers = list_tracking_tags_with_http_info(, opts)
  data
end

#list_tracking_tags_with_http_info(account_id, opts = {}) ⇒ Array<(ListTrackingTags200Response, Integer, Hash)>

List tracking tags Returns the tracking tags (Meta Pixels, or OpenAI Ads pixels) the connected ads account can see. Pass `?adAccountId=act_...` (Meta only) to scope the list to a single ad account; omit it to list every pixel reachable by the token (the name is then suffixed with the ad account it was discovered on, for disambiguation). The list view omits `code` — call `getTrackingTag` for the install snippet and full detail (Meta only; OpenAI Ads has no get-by-id endpoint). Meta (platform `metaads`) and OpenAI Ads (platform `openaiads`); other platforms return 405. The `accountId` must be the ads SocialAccount created by the Ads add-on connect flow (Meta) or the OpenAI Ads connect flow, not a Facebook/Instagram posting account. Get your Meta `act_...` ids from `GET /v1/ads/accounts`; `adAccountId` is ignored for OpenAI Ads (one API key maps to exactly one ad account).

Parameters:

  • account_id (String)

    Ads SocialAccount id (platform `metaads` or `openaiads`).

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Optional, Meta only. Scope to one ad account, e.g. `act_123456789`. Ignored for OpenAI Ads.

Returns:

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

    ListTrackingTags200Response data, response status code and response headers



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 476

def list_tracking_tags_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.list_tracking_tags ...'
  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 TrackingTagsApi.list_tracking_tags"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags'.sub('{' + 'accountId' + '}', CGI.escape(.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] || 'ListTrackingTags200Response'

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.list_tracking_tags",
    :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: TrackingTagsApi#list_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_tracking_tag_shared_account(account_id, tag_id, opts = {}) ⇒ nil

Stop sharing with an account adAccountId may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies. Meta only (platform metaads); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Ad account to unshare, e.g. `act_123456789`. May also be sent in the JSON body.

Returns:

  • (nil)


532
533
534
535
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 532

def (, tag_id, opts = {})
  (, tag_id, opts)
  nil
end

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

Stop sharing with an account `adAccountId` may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies. Meta only (platform `metaads`); other platforms return 405.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Ad account to unshare, e.g. `act_123456789`. May also be sent in the JSON body.

Returns:

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

    nil, response status code and response headers



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 544

def (, tag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.remove_tracking_tag_shared_account ...'
  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 TrackingTagsApi.remove_tracking_tag_shared_account"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling TrackingTagsApi.remove_tracking_tag_shared_account"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags/{tagId}/shared-accounts'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_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 => :"TrackingTagsApi.remove_tracking_tag_shared_account",
    :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: TrackingTagsApi#remove_tracking_tag_shared_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ nil

Set ad tracking tags Unified update. Send only the fields for the ad's platform: - Meta: urlTags (array of key,value). Meta creatives are immutable, so this rebuilds the creative and repoints the ad. By DEFAULT we PRESERVE the existing creative verbatim (re-post its object_story_spec + the new url_tags, reusing the image), so you send urlTags ALONE — no need to read back headline/body/CTA. creative (headline, body, callToAction, linkUrl, imageUrl) is OPTIONAL and only needed to rebuild explicitly, or for SHARE / page-post / dark / asset_feed creatives whose object_story_spec Meta strips (those return 422 asking for creative). - Google: trackingUrlTemplate and/or finalUrlSuffix (full template strings; account quota applies). - LinkedIn: dynamicValueParameters and/or customValueParameters (campaign-level Dynamic UTM).

Parameters:

  • ad_id (String)
  • update_ad_tracking_tags_request (UpdateAdTrackingTagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


603
604
605
606
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 603

def update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {})
  update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts)
  nil
end

#update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Set ad tracking tags Unified update. Send only the fields for the ad's platform: - Meta: `urlTags` (array of key,value). Meta creatives are immutable, so this rebuilds the creative and repoints the ad. By DEFAULT we PRESERVE the existing creative verbatim (re-post its object_story_spec + the new url_tags, reusing the image), so you send `urlTags` ALONE — no need to read back headline/body/CTA. `creative` (headline, body, callToAction, linkUrl, imageUrl) is OPTIONAL and only needed to rebuild explicitly, or for SHARE / page-post / dark / asset_feed creatives whose object_story_spec Meta strips (those return 422 asking for `creative`). - Google: `trackingUrlTemplate` and/or `finalUrlSuffix` (full template strings; account quota applies). - LinkedIn: `dynamicValueParameters` and/or `customValueParameters` (campaign-level Dynamic UTM).

Parameters:

  • ad_id (String)
  • update_ad_tracking_tags_request (UpdateAdTrackingTagsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 614

def update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.update_ad_tracking_tags ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling TrackingTagsApi.update_ad_tracking_tags"
  end
  # verify the required parameter 'update_ad_tracking_tags_request' is set
  if @api_client.config.client_side_validation && update_ad_tracking_tags_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_tracking_tags_request' when calling TrackingTagsApi.update_ad_tracking_tags"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/tracking-tags'.sub('{' + 'adId' + '}', CGI.escape(ad_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_ad_tracking_tags_request)

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.update_ad_tracking_tags",
    :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: TrackingTagsApi#update_ad_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_tracking_tag(account_id, tag_id, update_tracking_tag_request, opts = {}) ⇒ GetTrackingTag200Response

Update a tracking tag Partial-update a pixel. Whitelisted fields: name (rename), enableAutomaticMatching, automaticMatchingFields, firstPartyCookieStatus, dataUseSetting. At least one is required. Returns the re-fetched canonical tag. Meta only (platform metaads); other platforms return 405. There is no DELETE — Meta has no API to delete a pixel. To stop using one, unshare it from your ad accounts (DELETE .../tracking-tags/{tagId}/shared-accounts) or disable it in Events Manager.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



678
679
680
681
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 678

def update_tracking_tag(, tag_id, update_tracking_tag_request, opts = {})
  data, _status_code, _headers = update_tracking_tag_with_http_info(, tag_id, update_tracking_tag_request, opts)
  data
end

#update_tracking_tag_with_http_info(account_id, tag_id, update_tracking_tag_request, opts = {}) ⇒ Array<(GetTrackingTag200Response, Integer, Hash)>

Update a tracking tag Partial-update a pixel. Whitelisted fields: `name` (rename), `enableAutomaticMatching`, `automaticMatchingFields`, `firstPartyCookieStatus`, `dataUseSetting`. At least one is required. Returns the re-fetched canonical tag. Meta only (platform `metaads`); other platforms return 405. There is no DELETE — Meta has no API to delete a pixel. To stop using one, unshare it from your ad accounts (`DELETE .../tracking-tags/tagId/shared-accounts`) or disable it in Events Manager.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:

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

    GetTrackingTag200Response data, response status code and response headers



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 690

def update_tracking_tag_with_http_info(, tag_id, update_tracking_tag_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrackingTagsApi.update_tracking_tag ...'
  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 TrackingTagsApi.update_tracking_tag"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling TrackingTagsApi.update_tracking_tag"
  end
  # verify the required parameter 'update_tracking_tag_request' is set
  if @api_client.config.client_side_validation && update_tracking_tag_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_tracking_tag_request' when calling TrackingTagsApi.update_tracking_tag"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/tracking-tags/{tagId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_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_tracking_tag_request)

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

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

  new_options = opts.merge(
    :operation => :"TrackingTagsApi.update_tracking_tag",
    :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: TrackingTagsApi#update_tracking_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end