I'm trying to get the metric CompleteRegistration in the context of campaigns, but I'm only getting aggregated values by date.
This is my code:
from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.adspixel import AdsPixel
from facebook_business.adobjects.adspixelstats import AdsPixelStats
import json
with open(r"C:\Users\Daniar\facebook_creads.json") as file:
fb_creds = json.load(file)
MY_APP_ID = fb_creds['app_id']
MY_APP_SECRET = fb_creds['app_secret']
token = fb_creds['token']
my_app_id = MY_APP_ID
my_app_secret = MY_APP_SECRET
my_access_token = token
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
pixel = AdsPixel(<my_pixel_id>)
pixel.get_stats(params={'aggregation': 'event', 'event': 'CompleteRegistration', 'start_time': '2023-05-16'})
This is part of the output:
[<AdsPixelStatsResult> {
"aggregation": "event",
"data": [
{
"count": 129,
"value": "CompleteRegistration"
}
],
"start_time": "2023-05-16T03:00:00+0300"
}