How to get pixel/offsite conversion stats from Facebook's ads API? - facebook

I'm using the Python SDK for the Facebook ads api to get ad performance reports for Facebook ad campaigns.
The problem is that I can't find a way to get the number of pixel/offsite conversions, and I'm not even sure about where to look for it (campaign, adset, adgroup,ad creative..)
When I get stats on any level it is not included under "actions".
I looked through the documentation and only saw explanations for creating and defining pixels.
I'd appreciate any help you can provide.

If your pixel track conversions, you'll find them under the action response field if you use the field 'actions_group_by' set to 'action_type'. They come in the form of "offsite_conversion".

You can also use the ad reports endpoints to retrieve action counts and spend at different levels (time based and or by object, including ad): https://developers.facebook.com/docs/marketing-api/adreportstats/v2.2

Thanks for the answers.
Until now I was using the "get_stats" method and I didn't find this information there.
After posting here I looked at each level's object's methods and saw that there are a few different methods for getting ad stats:
One of the options is "get_conversion_stats", which is available at the account and adgroup levels. Additionally, from the account level it is possible to get the adset and adgroup's conversion data using "get_ad_campaign_conversion_stats" and "get_ad_group_conversion_stats".
(According to the "old" facebook ads terminology, where campaign is today's adset)
There might be more ways to get it, and I'd appreciate anyone telling me about the, but for now I'll be using these methods.
Hope this helps whoever encounters this issue next.

You can get these information from actions field of insight of each adset or ads.
For example: here is my command in facebook's developer site:

Related

Why "Fbclid" is not enough for attribution?

I've been tormented for a few months by this question!
I don't understand how Facebook pixel works deeply (and I assume only FB devs Know) but I have a few questions, if anyone can help me:
1- I launch a conversion campaign on Facebook ads, a specific ad gets a click, and a unique "fbclid" gets attributed to that click (?); if a conversion happens, and I send back the fbclid, Isn't Facebook supposed to be able to attribute it to the specific ad that generated that click, thus that fbclid? I thought that was the whole point of having a Server-to-server solution? since Apple announced iOS updates blocking cookies?
I come from an affiliate marketing background, we use tools like "Everflow" to track affiliate links, with a "transaction_id", that is, a unique value generated on every outgoing click. I thought the same logic would apply to fbclid.
Why are we asked to pass back to Facebook so much data when a conversion happens, like a name, email, etc... to be able to attribute the conversion to a campaign
( AND EVEN SO! Our Tracking is only 80% Accurate!!)
2- Can anyone explain how Facebook pixel actually works ? ignoring the Server to server (Conversion API ) solution, how does the Facebook base code + the conversion event script work to be able to attribute a conversion to a specific campaign? does it store the fbclid in your cookies? and when a conversion happens execute a request to Facebook?
3- AM I talking about 2 Different things here: FB attribution to campaigns VS Event matching? are they the same concept? Why is this so confusing to me? I couldn't find someone that's asking the same question, is it because I am missing something very obvious?
Thank you in advance!!

Facebook graph API not returning name with ads account listing

I'm trying to get all the personal ads account list. However, I get the IDs and act_ids but not the name along with them.I'm checking all the way but found no clue what's wrong i'm doing. I believe there's definitely way to get names with them as well.
I took all the reqired permissions, I believe
There's only IDs but no ad accounts name.
I was not getting name because by default the api doesn't return any other informations!
You have to mention the fields to get speicifc information you need. For me i needed name for the ad account so what i did is this
https://graph.facebook.com/v9.0/${fb_id}/adaccounts?fields=name&access_token=${token}
this way my result was expected one's. Although i was looking for this information speicifically but i didn't saw anywhere. Hope this will help you guys!

How to get like/share/comment data off of Facebook

I need to write a program for retrieving like/share/comment information from different groups I am the admin of on Facebook and tally up how many likes.shares/comments on each person does on the page to determine who is participating the most on different groups. But I have not done anything like this before so I was hoping to get some suggestions on how to do this. I would like to do it in Python or C++ if possible since I am familiar with those languages. But I am open to using PHP as well. Thanks in advance for any good suggestions.
This should get you started: https://developers.facebook.com/docs/groups-api/common-uses#getting-group-posts
For comments, shares and likes you would need to request the respective fields/endpoints by adding the fields parameter to your call. However you cannot retrieve user data unless your app had been reviewed and approved. So for testing purposes you can only test this with your own posts/shares/comments/likes.

Loading & Connecting Facebook Pixel Conversions Data

I am trying to load the Facebook Pixel Conversions level data from the Marketing/Insights API but not able to do it at the level I want or even properly
I have various pixels created in the form of events eg: Leads, Registrations etc and need to track them
After reading the documentation for Ads Pixels and it's stats - I was able to load some basic fields for now - but still not able to pull the s
GET API Query : https://graph.facebook.com/v2.9/act_/adspixels?fields=name,id,creation_time,last_fired_time
This gives me all the correct Ads Pixel details but how do I pull all the stats for this in the form of Events, their occurrences etc - will I be using more query parameters in this URL or a new URL - tried multiple iterations but was not able to get anything to work for now.
Tried this API Query as per documentation -: https://graph.facebook.com/v2.9//stats - but does not work even with fields added etc
Another issue I had was I am not at all able to test my queries with Graph API explorer - it keeps telling me that "Timeout issue" or "some other errors" when I am trying to use the app etc there. Do I need to publish and approve the app before hitting FB Ads data via the API Explorer?
All your suggestions and feedback will be highly appreciated here
I was searching for some things related and encoutered your thread.. I will report my findings .. maybe you already know this, but here it goes.
As far as querying with Graph API explorer.. it doesn't seem to work with Marketing API. You need to create your own app, and enable market api, in order to get the necessary token.
I am following the instructions on the link you provided: stats
Second.. to get the stats I am using
graph.facebook.com/v2.11/{pixel-id}/stats?aggregation=pixel_fire
The aggregation is necessary to get results. I can get the "Page View" event listed that I am tracking on a website.
I was able to compare these results, with the ones showed to me on the events manager page of the pixel.
Hope this helps

Adwords Impressions, Clicks and Cost, how to get these?

I'm developer for marketing company and I need some help with facebook ads. I've been trying to find method for getting data AUTOMATICALLY from facebook campaign that's created by the user.
I'm trying to create script that would get data for server.
So basically I need to get Impressions, Clicks and "Cost of clicks" from each day from facebook-ad-campaigns just by having user login data (username,password) and maybe the id-number of campaign being targeted.
Also if possible I'd like to know how you can shut down campaign(when cost of clicks is greater than budged used).
Are these operations possible? Can I use PHP/FQL for it? Can I get these via Url? If I need to use FQL, what tables I need to fetch data? Anything that can be performed without manually logging to facebook? If so, could I get some example code to do it for me? If it has something to do with Access Tokens, what kind of access rights do I need to grant for it?
Can it be possible to ask more questions in one question than you just did? Wow.
Answers are in order of them asked above. But I will not be answering any followup questions in this thread.
For most of your information can be found at: http://developers.facebook.com/docs/reference/ads-api/
In your code, set a trigger when it has reached that value in the adstatistics, then use the Ads API to shut it down using the pause feature
Yes, use the Ads API. http://developers.facebook.com/docs/reference/ads-api/
For some parts of it you can, for other parts you'll use Graph API object.
Yes, that's how the graph works.
Tables are listed in the documentation at http://developers.facebook.com/docs/reference/ads-api/
Nope.
Yep, example codes are there.
Yes, it sure does.
see https://developers.facebook.com/docs/reference/api/permissions