Adwords Impressions, Clicks and Cost, how to get these? - facebook-fql

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

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!!

How to enumerate list of registered users

From reading the technical documentation for ConnectyCube, there does not appear to be an API to enumerate registered users nor is there an API to test whether user is logged in. Is my understanding correct ?
Just figured out, I can tag the different users and enumerate based on the TAG.
Here you can use diff APIs to retrieve users https://developers.connectycube.com/flutter/authentication-and-users?id=retrieve-users
Also, there is chat activity last request at API https://developers.connectycube.com/flutter/messaging?id=get-last-activity
which can be used to determine whether a user is online or offline
Also, you may provide a detailed explanation what you gonna build, so there will be more specific suggestion

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.

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

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:

Facebook APIs using checkins as an entry to raffle

I've been exploring ways that it might be possible to promote the business of a friend of mine. One of these ways is by encouraging users to check in to his business, the incentive for this being that they go into the draw to win some kind of prize.
I've been trying to find if the code for this already exists but I might be looking in the wrong places. If it doesn't what would be the best way to do it using the graph APIs.
Thanks.
You can use Facebook app to check-in to your page/business.
All page check-ins can be fetched using following request by your code
https://graph.facebook.com/PAGE_ID/checkins?access_token=PAGE_ACCESS_TOKEN
If you want to get only specific time period check-ins use since and until params in query.
You have to parse the json response and store in an array and randomly select the winner.
you can contact the winner using their facebook id and send them a message.
You will have to write the code yourself, but it would essentially work like this:
Get the user to allow access to the "Raffle" application and get their email address and permissions to look at their check-ins. Email is required to contact the winner.
Use a scheduled script (cronjob) to periodically check if the user has checked-in anywhere (in particular, the business you want to promote).
Award a raffle ticket for each unique check-in within a 24 hour period.
Hold a draw between all the users who checked in on that day or week and award the prize to someone randomly.
Pretty simple flow, but complex code.