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 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 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. NOT idempotent: each call creates a new pixel. Do not retry blindly on timeout. Meta only (platform metaads); other platforms return 405.

Parameters:

  • account_id (String)

    Meta ads SocialAccount id (platform `metaads`).

  • 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 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 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`. NOT idempotent: each call creates a new pixel. Do not retry blindly on timeout. Meta only (platform `metaads`); other platforms return 405.

Parameters:

  • account_id (String)

    Meta ads SocialAccount id (platform `metaads`).

  • 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_tracking_tag(account_id, tag_id, opts = {}) ⇒ CreateTrackingTag201Response

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.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



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

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:



254
255
256
257
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 254

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:



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
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 268

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<(CreateTrackingTag201Response, 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.

Parameters:

  • account_id (String)
  • tag_id (String)

    Pixel id.

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

    the optional parameters

Returns:



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

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] || 'CreateTrackingTag201Response'

  # 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:



333
334
335
336
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 333

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:



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
391
392
393
394
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 344

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) the connected ads account can see. Pass ?adAccountId=act_... 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 today (platform metaads); other platforms return 405. The accountId must be the Meta ads SocialAccount created by the Ads add-on connect flow, not a Facebook/Instagram posting account. Get your act_... ids from GET /v1/ads/accounts.

Parameters:

  • account_id (String)

    Meta ads SocialAccount id (platform `metaads`).

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Optional. Scope to one ad account, e.g. `act_123456789`.

Returns:



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

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) the connected ads account can see. Pass `?adAccountId=act_...` 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 today (platform `metaads`); other platforms return 405. The `accountId` must be the Meta ads SocialAccount created by the Ads add-on connect flow, not a Facebook/Instagram posting account. Get your `act_...` ids from `GET /v1/ads/accounts`.

Parameters:

  • account_id (String)

    Meta ads SocialAccount id (platform `metaads`).

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Optional. Scope to one ad account, e.g. `act_123456789`.

Returns:

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

    ListTrackingTags200Response data, response status code and response headers



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

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)


469
470
471
472
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 469

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



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
524
525
526
527
528
529
530
531
532
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 481

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_tracking_tag(account_id, tag_id, update_tracking_tag_request, opts = {}) ⇒ CreateTrackingTag201Response

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:



541
542
543
544
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 541

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<(CreateTrackingTag201Response, 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:



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
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/zernio-sdk/api/tracking_tags_api.rb', line 553

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] || 'CreateTrackingTag201Response'

  # 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