Open edpruuv opened 5 months ago
Hi @edpruuv 👋
When you run, your example below -> you are requesting the endpoint {ad-account-id}/campaigns
https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/#fields
connection = AdAccount(customer_id)
campaigns = connection.get_campaigns(fields=fields, params=params)
I think you misunderstood the breakdowns parts witch is related to the insights
🛑 All breakdowns are not always compatible with each others ( combining breakdowns )
# {ad-account-id}/insights
account = AdAccount("act_" + self.account_id)
insights = account.get_insights(
fields= [ "account_id", .... , "clicks", "impressions", "spend" ... ]
params={
"use_unified_attribution_setting": True,
"breakdowns": [
"publisher_platform",
"platform_position",
"impression_device",
],
"level": "ad",
"time_increment": 1,
"time_range": {
"since": XYZ,
"until": XYZ,
},
},
is_async=True,
)
insights.api_get()
Thanks a ton @Just1B !
I will try this now. This is my first time working with facebook marketing api.
Your comment is greatly appreciated! I'll give a feedback once I tried it out.
Cheers!
I got the folowing insight data @Just1B
insight_data = {'ad_id': '2386******17828250422', 'ad_name': 'A***', 'adset_id': '238622**', 'campaign_id': '238**21**260422', 'clicks': '0', 'cpm': '0', 'ctr': '0', 'date_start': '2024-06-07', 'date_stop': '2024-06-07', 'impression_device': 'iphone', 'impressions': '1', 'platform_position': 'search', 'publisher_platform': 'facebook', 'spend': '0'}
Specifications for URL dynamic parameters link: https://www.facebook.com/business/help/2360940870872492
i think you can get them on the adcreative
https://developers.facebook.com/docs/instagram/ads-api/guides/get-ad-insights/
https://developers.facebook.com/docs/marketing-api/reference/ad-creative#fields
We already have url_tags
but the dynamic url parameters are not being replaced automatically
utm_source=facebook&utm_medium={{site_source_name}}&utm_campaign={{placement}}&utm_content={{ad.id}}
That's why I need to find where I can get the site_source_name
and placement
value
Please advice.
Thank you
Hey @edpruuv how's it going?
Were you able to find any solution to this problem? I'm facing the same issue that you mentioned
Given this url tag placement={{placement}} site_source_name={{site_source_name}}
Where do I get these values using the SDK?
Which specific field in the following to they belong?
Campaign.Field AdSet.Field Ad.Field
I tried the following:
`
CAMPAIGN_FIELDS = [ Campaign.Field.account_id, Campaign.Field.id, Campaign.Field.name, Campaign.Field.budget_remaining, Campaign.Field.objective, ] connection = AdAccount(customer_id)
params = {
campaigns = connection.get_campaigns(fields=fields, params=params)
`
But all I get is this output:
{ "account_id": "1**705********1241", "budget_remaining": "0", "id": "120208422448000423", "name": "Creative and Audience Test", "objective": "OUTCOME_LEADS" }
Should I go for the Adset or Ad level?
Please help!