Facebook offline conversions without customer data associating with ad reporting - facebook

I have ads on Facebook driving traffic to our site.
I set this on land
fbq('init', 'my_id', {
external_id: "d1fd01cb777cdcdbf5161db889bf841e"
})
and later if we have an actual purchase I send an offline purchase event using extern_id to match on.
[{
:match_keys => {
:extern_id => "d1fd01cb777cdcdbf5161db889bf841e"
},
:event_time => 1579464000,
:event_name => "Purchase",
:value => 5.0,
:currency => "USD",
:order_id => "8431715",
:custom_data => {
:event_source => "affiliate"
}
}]
however I am not seeing the offline events associated with the ads.
Has anyone else had this issue and have they found a solution??

Davinj, if I understood you correctly, you try to send pixel events giving your extren_id and then matching it back to customers who made a purchase as offline conversions? I see several issue with this:
You have your extern_id in pixel's init code instead of event itself. Like standard conversions or at least page view. Also you call it extrn[al]_id which is inconsistent with extern_id.
I doubt that such scenario would work in the first place as offline conversions do not usually play well with pixel and might not be able to have the parameter from pixel as a match key. Even if the do, which you might find via testing, you'll still have to send other match keys to identify the FB user like email, phone number, etc. Here are docs explicitly recommending that: https://developers.facebook.com/docs/marketing-api/offline-conversions#extern-id
When you have a consistent pixel setup and can see proper events with corresponding parameters, you'll be able to see if you idea is viable.
Generally FB explicitly says that extern_id is a user identifier in you system and probably has to be different for every customer. It can be send as a lonely match key only after you already used it once with other match cases to identify an FB user. Otherwise FB just skips such events and you'll see nothing.
Hope it helps.

#Davinj,
There is another way to send offline events via server-side-api to your pixel's dataset:
https://developers.facebook.com/docs/marketing-api/server-side-api
I think these should match up as they show in the same pixel when using event manager.
I had the same assumptions as you but I think their offline conversions is for people who didn't land on your site before converting. Maybe just saw your advert or something.

Related

Facebook pixel events call from server

I have absolutelly the same question as dan here - Facebook conversion pixel with "server to server" option . There was written, that there was no way, but it was 2013, so I hope something changed.
So, is there any way to call facebook pixel events (e.g. CompleteRegistration) from server side now?
I can describe situation in more details. Imagine, that user visits our site, where fb pixel tracks 'PageView' of course. When user passes form and sends his phone number, we call 'Lead' event. But then we need to track one more event, when our manager successfully confirmes this user! Of course, it happens on other computer and so on, so there is no idea, how to "connect" to base user.
I've seen a lot of documentation departments like this, but I can't fully understand even if it's possible or not.
Logically, we need to generate specific id for user (or it can be phone number really), when 'Lead' event is called. Then, we should use this id to 'CompleteRegistration' for that user. But I can't understand, how to do it technically.
It would be gratefull, if somebody could explain it.
P.S. As I understand, it is fully available in API for mobile apps. Is it ok idea to use it for our situation, if there is no other solution?
Use Offline Conversions to record events that happen after a user has left your website. Logging these conversions, technically, is very easy. Setting everything up takes a little effort
tldr; check the code below
Follow setup steps in the FB docs (Setup steps 1-5) which are:
Setup facebook Business Manager account
Add a new app to Business Manager account
Create an Ad account, if you don't already have one
Create a System User for the ad account
After the setup, follow Upload Event Data steps on the same page, steps 1-3 to create an offline event set and associate it with your ad. These can be carried out in the Graph API Explorer by following the links in the examples. These can be done programmatically, but is out of the scope of making the event calls from the server for one campaign.
Once you have created the event set, then you can upload your CompleteRegistration events!
You will need to make a multipart form data request to FB, the data key will be an array of your conversion events. As #Cbroe mentioned, you must hash your match keys (the data you have available about your user to match them with a FB user) before sending to FB. The more match keys you are able to provide, the better chance at matching your user. So if you can get their email and phone at the same time, you're much more likely to match your user.
Here's an example of the call to FB using node.js:
var request = require('request')
// The access token you generated for your system user
var access_token = 'your_access_token'
// The ID of the conversion set you created
var conversionId = 'your_conversion_set_id'
var options = {
url: 'https://graph.facebook.com/v2.12/' + conversionId + '/events',
formData: {
access_token: access_token,
upload_tag: 'registrations', //optional
data: [{
match_keys: {
"phone": ["<HASH>", "<HASH>"]
},
currency: "USD",
event_name: "CompleteRegistration",
event_time: 1456870902,
custom_data: { // optional
event_source: "manager approved"
},
}]
}
}
request(options, function(err, result) {
// error handle and check for success
})
Offline Conversion Docs
Facebook has now a Server-Side API: https://developers.facebook.com/docs/marketing-api/server-side-api/get-started
Implementing this is similar to implementing the offline events outlined in the accepted answer.
Keep in mind that it will always be cumbersome to track and connect events from the browser and from your server. You need to share a unique user id between the browser and server, so that Facebook (or any other analytics provider) will know that the event belongs to the same user.
Tools like mixpanel.com and amplitude.com may be more tailored to your needs, but will get very expensive once you move out of the free tier (100+ EUR at mixpanel, 1000+ EUR at Amplitude, monthly). Those tools are tailored towards company success, whereas Facebook is tailored towards selling and measuring Facebook ads.

Facebook, post to wall, using me/photos, in 2.1 Facebook?

Considering a Unity project from ~3 years ago, and using Facebook graph I'm pretty sure it was 1.0,
You could post to a user's wall like this:
private byte[] imageAsBytes;
Texture2D im = ... your image
imageAsBytes = im.EncodeToPNG();
Dictionary<string, object> dct = new Dictionary<string, object>
{
{ "message", "Marketing message here" },
{ "picture", imageAsBytes }
};
Facebook.instance.graphRequest(
"me/photos", HTTPVerb.POST, dct, completionHandler );
As has been made known for many months now, there is a change to this coming.
With Facebook 2.1 being required as of this Aug 8, I'm rather confused about, simply, whether this still works in 2.1?
in short, how to post an image to the user's wall, in 2.1?
Note - here's where to find the important resource CBRoe mentions below...
Note that the only problem with the alternative, FB.FeedShare() is that, as far as I understand, you can not actually post an image (sure, you can link to an image at a URL).
This isn’t deprecated in any way. But since API v2.0 you need to get the necessary permission reviewed and approved by Facebook, before you can ask normal users for it.
And yes, this is a rather major change - but that's why it was announced way ahead of time, via a lot of channels. We all know how fast the IT world moves and changes- so I think you can not put the blame on Facebook here. If you were "out of the game" (this particular one) for over three years, you just have to go and find the resources that a) list what's changed, and b) what the current state of things is. And the developer section does both. The changelog has already been mentioned, and for example the need to get permissions reviewed now is also mentioned on the starting page for Facebook login, right at the top under Essential Guides.
Plus, Facebook actively informs you about changes - if you let them. Go to https://developers.facebook.com/settings/developer/contact/ where you'll find several options to get informed about specific stuff via e-mail.
You can check the changelog to see what changes happened https://developers.facebook.com/docs/apps/changelog. There are no changes for /me/photos as far as I can tell.
It is possible to use image data or a URL.
See https://developers.facebook.com/docs/graph-api/reference/user/photos#Creating for more info

GWT RequestFactory: check if members have been set without permission

I am working with GWT / RequestFactory and a set of customer requirements regarding permissions. Let me explain a basic example:
Every user is assigned to a company. Every user should be able to edit company's core data - but only e.g contact information, website etc. Security-relevant ones like BIC/SWIFT, IBAN, Company name and so on can only be changed if the user has a certain permission XY.
So far so good, on the client side I can check the permissions and disable those fields the user is not allowed to edit. But what would be the most elegant way to ensure on the server side that those fields have not been set without permission?
My problem is that I cannot track changes on the server side. Having #PreAuthorize on every setter is not an option too, because it would end in an authorization-massacre in each and every entity.
At the moment I am following a workaround: every field that is secured / depends on a given permission is passed as an argument to the entity-method and is excluded from the proxy. That way, values cannot be set using the proxy and I can check in my server code if the user has permissions. If not, nothing happens. If user has permissions, I set the values manually. But that produces a lot of boilerplate-code and ugly method signatures because the number of values passed to the method could get large.
I hope you understand my issue. I'm looking forward for your opinions and tips. Thank you in advance.
Well, you can receive many answers (different each other), and all of them could be right, so, at the end is your call. Wait for others answers. I am going to give you the approach that I followed (and it worked pretty well). :D.
Under my opinion, the server should do less as possible, so keep the logic for allowing modify each param on the server I think it is not a scalable solution (if your system has 1M users modifying everything at the same time, will your server work fluent?). I prefer let the client do the job (like Roomba :D).
For solving that problem, in our system we implemented an Access Control List solution. You can store in your db, on each user entity, a list with granted permissions. So, when that information arrives to the client (after user's log in, for example), you can get them, and show the fields that he/she is allow to modify.
Something like:
if (canModifyPersonalDetails(user.getAcls(), ...) ) {
//show labels ...
}
if (canModifyBankDetails(user.getAcls(), ...) ) {
//show labels
}
You can not avoid server call for log in, so it is not a big deal send the extra information (think about the ACLs could be simple list of integers 0 means personal details, 1 bank details....).
If you are dealing with very compromised information and you prefer do some stuff on the server, in that case probably I'd set up a security level, when you are persisting/updating your proxy, I'd do something like:
if (isAllowForPersonalDetails(user.getSecurityCode()) {
//update the modified personal details
}
if (isAllowForBankDetails(user.getSecurityCode()) {
//update the modified bank details
}
user.update();
I am a big fan of clear User GUI's, and a very big fan of let the server free as much as possible, so I prefer the first option. But if you have constraints for modifying user entity in db, or you prefer do not modify your views, or any constraint with security, maybe the second option is the best one for you.
Hope that helps!

OpenGraph: how can i specify a filter in FB.api?

I have built a Facebook app using OpenGraph that permits the users to write reviews on concerts, so that I've defined a concert_id attribute on which the user can insert a review.
Now I would like to show all the reviews inserted for a certain concert_id but cannot find a way. If I do (in JS)
FB.api('/me/MY_APP:action', { limit: 0}, function(response) {
console.log(response);
});
I get all items. This app has to be consumed by mobile, I think it is bad to get all items and, then, filtering only the concert_id i need. What do I have to do to apply a where condition in OpenGraph to a custom action?
As far as I can tell from the API and the Facebook developer pages, it's not possible to filter a call by custom action property using the public Open Graph API.
Two options I can think of:
Option 1:
Implement the category filter by creating custom category objects:
if "review" is a custom action and
GET https://graph.facebook.com/me/[name_space]:review
returns all review actions then
GET https://graph.facebook.com/me/[name_space]:review/scifi_movie
GET https://graph.facebook.com/me/[name_space]:review/action_movie
return actions specific to movie type, where scifi_movie and action_movie are custom objects. You would need to create one object type for each category.
Option 2:
Implement a custom action for each category, e.g.
review_scifi_movie
review_action_movie
These are not particularly elegant solutions but perhaps useful as a hack if nothing else works and you really don't want to do filtering on client side.
The Facebook API will not return individual published objects for a particular action, but that's not your only problem. By the look of it, you're trying to bring in ALL the reviews given for a concert, right? (Meaning those by other users too).
The "/me/" part of the Facebook API call will only return those published actions made by the user that is currently logged in. That won't work for you, as you want those of all your users
The only suggestion I can give is to create a simple web service, where you store all the reviews given for the various concerts. Use this service to pull in reviews given for a particular concert. (I use a similar methodology for reviews in an app of my own).
I dont understand javascript or opengraph..
But when I required in JAVA to fetch reviews made by any user I have used FQL for that and It retrived me all the reviews and FQL also used to fetch all the tables related to Facebook.
I don't think that you can pull that off with the JS SDK.
You can do that in your server though, and since this is a mobile app (or has a mobile version) then that's another good reason to remove this from the client responsibility.
In the server side you can ask facebook for the published actions as you posted, filter them and then return the response.
Another thing that you can do is to save each published action in your db (on each action post you should get an id back from facebook, just persist that) and then you can easily filter the published actions according to what ever criteria you want/need (since you are no longer restricted by the facebook api).
The open graph thing is still pretty new and not tat mature, for example you can't use FQL with it, something that could have been handy for your case.
Regardless though I think that a server solution is best for calculations when mobile is concerned.
i don't know exactly but try this
if (session.authResponse) {
FB.api('/me', {
fields: 'name, picture' // here mention your fields
},
function(response) {
if (!response.error) {
//here response value
});

Real Time Update not working for some fields?

I'm checking wich fields from the User object are susceptible to RTU (real time updates); in the documentation it says:
The User object supports Real-Time Updates for all fields except the
verified property.
But, so far, for this fields:
video upload limits television significant other favorite_teams
favorite_athletes political interested_in bio updated_time
third_party_id gender user_likes languages
I've got this message:
{"error":{"message":"(#100) \"SOME_FIELD\" is an invalid field name","type":"OAuthException"}}
My application has the necessary permissions, checked by using this method (taken from this url):
https://api.facebook.com/method/users.hasAppPermission?ext_perm=SOME_PERMISSION&uid=UID&access_token=ACCESS_TOKEN_FOR_MY_APP
Am I missing something? Those fields are working for someone else or is just me?
Thanks.
I've tried the same. Facebook seems to be a little slow here. They did not implement all fields in the RTU. You can find a list of available fields here (under objects): https://developers.facebook.com/docs/reference/api/realtime/
However, even this list does not seem correct, as I did not get for example television to work either.
It is kind of odd to ask for the object "user" to get notifications about you page.. This all does not seem to be finished yet..