xdevplatform/twitter-python-ads-sdk

How to get Twitter "Reach" measure???

Closed this issue · 2 comments

How should I get "Reach" in my LineItem report?

My API script attached.
Twitter Report API_LineItem.txt

I'm stuck on how to get Audience_Id as it may help to get the Reach. Can anyone one tell how should I find the audience id?

@KathyShen so by "Reach", you meant "Reach Estimate"?
https://developer.twitter.com/en/docs/ads/campaign-management/api-reference/reach-estimate

@ChidiChinob You can use TailoredAudience class

from twitter_ads.client import Client
from twitter_ads.audience import TailoredAudience


CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
ACCOUNT_ID = ''

# initialize the client
client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

# load the advertiser account instance
account = client.accounts(ACCOUNT_ID)

# fetch audiences
audiences = TailoredAudience.all(account)

# iterate for each audience
for k in audiences:
    print(("id: {}, name: {}").format(k.id, k.name))