Fetching comments from active facebook ads - facebook

I am working on a Facebook comment manager and I just can't manage to get only active ad creatives from Facebook API.
Is there a way to get all ad creatives filtered by their status?
I can't afford to check all ads manually, because I plan to pull ads every few minutes and I would be hitting Facebook's rate limit.

There are a number of endpoints that could help you do this, but would require you to make multiple API calls.
Step One: Get all Ads
Assuming you have managed to get the Ad Account ID from a previous API call, you will be able to get all Ads running against that account by making a GET request to the /act_{ad_account_id}/ads?fields=name endpoint.
Step Two: Get Images with Active Status
Next you can call the /{ad_id}/adcreatives?fields=name,image_hash,status endpoint for each Ad, which will return the name of the creative, the image hash that was used, and the status of the creative.
If you require the status of the actual Ad itself rather than the status of the creative, you will need to do another step in between Step One and Step Two, where you call /{ad_id}?fields=name,status on each Ad, then filter ACTIVE campaigns.
EDIT:
You can use /act_{ad_account_id}/adcreatives?fields=status,image_hash,title to get all creatives and statuses associated with the account. This would reduce your API call rate although would mean you would need to sort the creative to match with the ads. Using the title field would give the title of the ad it was used in the ad. Facebook does not offer any other fields related to the ad itself.

You can limit results to ads whose effective_status is ACTIVE.
Here is a sample request:
act_123/ads?filtering=[{"field":"effective_status","operator":"IN","value":["PAUSED"]}]
Ad fields
Insight Parameter

Related

Facebook Ads Insights API Not returning data for one ad

I'm trying to pull some data from Facebook Ads Insights API and I get the correct data from one campaign/ad and with a different campaign/ad I get nothing.
It's "" vs. "{\"data\":[]}" (one is nothing at at, one is empty result)
The ad that returns data has a status of "Not Delivering" and the one that doesn't return anything has a status of "inactive". I only have two ads to work with currently. Can I not get data from inactive ads through the API? In the web interface the data is there. Is there a switch or something for inactive ads that I might not have or I might be sending incorrectly?
EDIT:
Actually, if I switch the order of which ad I pull first it changes which one returns nothing. Does Facebook Marketing API not like you pulling ad data one after the other? What is going on here?

Facebook API Campaign Create

Some background...
I'm trying to create a Campaign using the graph.facebook.com API. When I post, I get an ID back, which I thought would most likely be the Campaign-id, when I do a Get, I am returned a list of ID's...presumably campaigns.
When I go the AdManager page to see all my campaigns there is nothing. I have tried searching Adverts and Adsets, but also nothing. I now have a list of Id's but no idea what they actually represent.
If I do a GET on one of Ids I was hoping I might get some further information about the object (node), but instead I just get the id back and nothing else.
The AdAccount I am POSTing the campaigns to is a SandBox account, not sure if this makes a difference.
...
Can anyone confirm whether or not the id I am receiving is likely to be the CampaignId?
Is there a special way to see campaign's created for a sandbox account?
Is there a further stage I need to complete to get the Camapigns to show up?
many thanks.

Multiple adsense publisher id's mixing and matching etc

Does anyone know the adsense TOS regarding using more than one publisher ID
on a site.
can a page have 1 ad using publisher ID#1 and another ad using publisher ID#2
i.e the top banner ad is using one pubid and the bottom banner ad is using another
pubid
This is important as I have been noticing some very strange results lately, but
I want to make certain what I am doing is 'legal' before saying more..
You are allowed to have multiple Adsence id's on the same site, even the same page as long as the total number of adds per page is not exceeded (I don't think extra adds will show up if you have more than 3 anyway.)
There are a number of sites around that allow you to include your Adsence ads with your content. Take a look at these:
www.weebly.com
www.hubpages.com
www.triond.com
More...
Its 100% allowed to use more than one publisher ID on a single page or across a website provided the total number of ad units per page is not exceeded (that per page not per account.)
http://productforums.google.com/forum/#!topic/adsense/eBwPjDixtUY
The answer is that yes, we do allow this. But before you place your ad code on the same page or site as another publisher, here are a few important points to keep in mind:
The maximum number of products per page will remain the same.
If you don't own the site, you'll need to receive permission from the site owner to display your ads on their pages.
We're unable to divide earnings between accounts, so any revenue generated will be credited to the account associated with the ad unit that was clicked or viewed.
Any shared site that displays Google ads must also comply with our program policies.
You're responsible for the content of any page where your ad code appears. Before placing your ad code on another publisher's site, we recommend reviewing the site for any policy violations.
And one final tip before giving your code to another publisher -- try using our Allowed Sites feature to monitor where your ads are appearing and keep your account in good standing.
http://adsense.blogspot.com/2008/07/sharing-your-ad-space.html

Ads api: request only those creatives that are currently used

When using Facebook's Ads API, I'd like to request all creatives for an account that are currently being used by an adgroup. I.e. where the count_current_adgroups value is > 0. I can pull all creatives for the account with:
">https://graph.facebook.com/adcreatives/?ids=act_123456789&access_token=
How do you limit this request to only return adcreatives that are being used by an adgroup?
Thanks.
John - This functionality doesn't currently exist. Your best bet is to load all the active adgroups in your account like this:
https://graph.facebook.com/adaccount/adgroups
Inside of each adgroup, it will list the adcreative that is currently associated with that adgroup. Collect all of these adcreative IDs together, and deduplicate them, then load them all using this syntax:
https://graph.facebook.com/adaccount/adcreatives?ids=1,2,3,4
This should give you the functionality you need, although it will take two calls to the Facebook Ads API to compute what you want.

Using GA Data Export API to Get All UA's

I am using the GA Data Export API to interact with Google Analytics and I'm making a lot of progress, I am using this URL Endpoint initially to pull all the profiles under an account:
https://www.google.com/analytics/feeds/accounts/default
This URL retrieves each GA ID (profile) and each UA. One thing I've realized is one account can contain multiple UAs and when this happens, this request pulls all profiles. We have a client who has about 115 profiles under like 10 different UAs, and the request takes about 30 seconds for the initial request (and then I believe it must be cached, because it speeds up considerably after this, but then the next day the same thing occurs).
Is there a way to get a list of UA's without pulling the profiles? This way I can query the UA specifically for the profiles instead of pulling each one.
Any advice on this would be really helpful!
Thanks
UPDATE: Here's some documentation on the specific call I am using right now:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html
UPDATE 1: I have found some interesting information in the docs
Once your application has verified
that the user has Analytics access,
its next step is to find out which
Analytics accounts the user has access
to. Remember, users can have access to
many different accounts, and within
them, many different profiles. For
this reason, your application cannot
access any report information without
first requesting the list of accounts
available to the user. The resulting
accounts feed returns that list, but
most importantly, the list also
contains the account profiles that the
user can view.
So this means that you have to use the default accounts call to get these back? Surely, somebody has had this issue before?
So apparently, you can query the account if you know the UA-ID, however there is no way to get back a list of only UA IDs.
One way you can do it is have the user enter their own UA ID instead of having them choose one; not as user-friendly as it could be but better than making the user wait 30 seconds!