How to get the ad_format on Facebook Ads Api to make a good preview? - facebook

Per the documentation at https://developers.facebook.com/docs/reference/ads-api/generatepreview/,
i need to request ad previews for Facebook ads in a specific format based on the ad format.
Right now, i always request RIGHT_COLUMN_STANDARD, which won't work for some ad.
Is there a way to get directly ad_format ?

There is probably two things you can try. The first is to take a look at the page_types in the target_spec which belongs to the AdGroup and map the target to the type of preview you need.
The second is to take a look at the object_type int the AdCreative and again map that to the types of preview that are supported.

Related

Is there a way to get custom conversion data for each ads through Facebook marketing API?

Found this https://developers.facebook.com/docs/marketing-api/reference/custom-conversion/
but it doesn't help me.
I'm trying to get the 'custom conversion' data for each ads but according to the ref. above I can the number for each custom conversion (not separate for each ads).
Any idea ? :)
The link you gave describes the custom conversion object itself (not related to any ad). For individual ad's conversion data you would look at the insights:
https://developers.facebook.com/docs/marketing-api/insights/v2.9
Specifically, query the actions field and filter by action_type (refer to the filtering parameter on insights for how to do filtering https://developers.facebook.com/docs/marketing-api/insights/parameters/v2.9)
And this answer has a concrete example:
Facebook Marketing API Select Fields

Embed API demo not working

I tried using this Google Analytics Embed API Demo, of course with my own ClientID (49803909):
Embed API Demo
However, instead of the graphic I should be getting, I only get a blank page. I did follow the instructions quite carefully. Does this work for others? Any ideas of what may be wrong?
PS: Here's the screenshot of where I am getting the id from. #DaImTo was right that just 49803909 wasn't it, but I also tried to full long string and even the service id below (the one with #), all to the same effect (a blank screen). So, is this the wrong screen then?
I think #DalmTo is correct. You're most likely using one of the many other Google Analytics IDs instead of using a valid Client ID (which is not Google Analytics-specific, it's a general ID used for accessing Google APIs), and you're probably getting errors logged to the JavaScript console that say something to that affect.
If you follow the steps in this Embed API Developer Guide, you'll see instructions on how to create a Client ID to use with the Embed API.

How to search Facebook's "invitable_friends" results

I have a Facebook app, and I'd like to allow my users to invite their Facebook friends to my app. The proper endpoint is /me/invitable_friends which is working well. But towards the bottom of that doc page, they recommend implementing a "search box" to filter the results, yet they don't offer any example of how to do this. I've searched around and haven't found anything.
It doesn't appear as though you can pass additional params for filtering the results. Obviously I can filter the results after the fact, but that's not scalable since the API only returns ~20 users at a time. That limit is modifiable (I believe), though it's of course not wise to bump it too high.
So how can I build a search box interface if I can't pass the search text to the endpoint? I must be missing something.
Thanks in advance.
PS - I'm using the JS SDK.
You should probably file a bug.
Based on the documentation the default size is 1000 records (average Facebook friend list size is 300-400)
If you don't see the next parameter at the end of the result under paging then there are no more results.

Facebook Ads, possible to add dynamic parameters in URL for FB to populate later?

I need to add ad_group id to ad's URL. However, I can only obtain the id after creating the ad, not before. Is it possible for me to specify a parameter in the URL so that it can be populated by FB when the ad is created? I know double click of Google supports this.
A solution has been released recently:
https://www.linkedin.com/pulse/new-facebook-ads-url-dynamic-parameters-trishan-naidoo/
Dynamic Parameters & Values
There are currently 8 parameters that can be dynamically inserted into ad URLs:
Site Source Name [site_source_name] - This parameter has 4 possible values depending on whether the ad appeared on Facebook ('fb'), Instagram ('ig'), Messenger ('msg') or the Audience Network ('an'). Note: Facebook's help documentation incorrectly lists {{site_source_name}} as the dynamic parameter but my testing shows that it only works with square brackets.
Placement {{placement}} - This parameter has 6 possible values depending on whether the ad appeared on the desktop feed, mobile feed or the right column on Facebook, the Messenger inbox or within the Instagram Feed or Instagram Stories.
Campaign, Ad Set & Ad Names {{campaign.name}} {{adset.name}} {{ad.name}} - This parameter will dynamically insert the name of the campaign, ad set or ad according to how you have named each when setting up ads.
Campaign, Ad Set & Ad IDs {{campaign.id}} {{adset.id}} {{ad.id}} - This parameter will dynamically insert the automatically assigned ID of the campaign, ad set or ad. To find out IDs, you will need to customise your columns to add the relevant ID column.
No, there is no way to automatically add the adgroup ID to the referral params of an adgroup - typically developers use their own system's reference for tracking purposes in the url tags, or add the creative ID, something like that
Update: Facebook has recently published a list of dynamic parameters that will be populated in your URL's.
The list is available on their site

Facebook Invite Friend Dialog app_non_users filter seems to have no effect

I am building a Facebook Application that sits in a facebook page tab (and has a Canvas URL hook.) I am trying to implement the app_non_users filter.
When I introduce the filter, here is what I see:
In both ['all'] and ['app_non_users'] everyone is shown (including those who have authorized the app)
In ['app_users'] setting, no one is shown.
I am not running this on mobile, and I am passing the parameter in expected JSON form (proved by the fact that Facebook is doing different things for different values.)
I am also not using any other conflicting filters or even the "to" parameter. When I inspect the network tab, I see the following params being passed to FB:
message:Invite Message
title:Select from list of your friends
filters:['app_non_users']
api_key:xxxxxxx
app_id:xxxxxxxx
locale:en_US
sdk:joey
display:async
frictionless:false
redirect_uri:https://xyz.com
__d:1
__user:xxxxxxxx
__a:1
__dyn:798aD5z5CCU-wEbw
__req:9
Based on the above results, it seems to me that Facebook doesn't consider just app authorization to mean that a user is a app_user. So, exactly what makes a user app_user and how do I, as a app dev, make that change?
From the question I think you are using the filter alone without any other filter for the Request dialog box. If that is correct then follow the bug here as it points to the same issue as you are having.
As an alternate, until the bug is fixed, I might suggest you to use more than one filter so that both of them work correctly. I tried the same with RELL here.
I made workaround using 'exclude_ids' parameter and server side PHP.
Usng PHP I have populated exclude_ids with ids of current user's friends which already entered my app (I have those fb ids in my database), so Request dialog doesn't display those friends to user.