Marketing API Version

AdsPixel

Fields

audiences, code, id, last_fired_time, name, owner_ad_account

AdsPixel.get_agencies ()

Returns a list of businesses associated with the ads pixel

Sample Code

pixel_id = '417531085081002'
pixel = AdsPixel(pixel_id)
shared_agencies = pixel.get_agencies()
print shared_agencies

AdsPixel.share_pixel_with_ad_account (business_id, account_id)

Associate ads pixel with another ad account

Name Type Description Required

business_id

numeric

The ID of the Business Manager.

Yes

account_id

string

The ID of the Ad Account starting with "act_".

Yes

Sample Code

business_id = '1454288444842444'
act_id = 'act_1505766289694659'
destination_account_id = act_id.replace("act_", "")
pixel_id = '417531085081002'
pixel = AdsPixel(pixel_id)
pixel.share_pixel_with_ad_account(business_id, destination_account_id)
print pixel

AdsPixel.unshare_pixel_from_ad_account (business_id, account_id)

Dis-associates the ads pixel from an adaccount

Name Type Description Required

business_id

numeric

The ID of the Business Manager.

Yes

account_id

string

The ID of the Ad Account starting with "act_".

Yes

Sample Code

business_id = '1454288444842444'
account_id = 'act_1505766289694659'.replace("act_", "")
pixel_id = '417531085081002'
pixel = AdsPixel(pixel_id)
pixel.unshare_pixel_from_ad_account(business_id, account_id)
print pixel