Reputation: 4528
I'm using a fb.ui send method to allow user to share a link through Facebook. (eg http://example.com/affiliateid=myuseraffiliateid) My problem is that the og:url of the shared page doesn't have this parameter, and og:url always take precedence.
Using the Facebook Send button, I'm able to send a fb_ref parameter, so the shared url is http://example.com/fb_ref=myuseraffiliateid. This solution is OK for me, I just have to set affiliate_id = fb_ref in the server side code of my page. However, I can't use the facebook send button as I need to prepopulate the "to" field.
In short, what I'm looking for is a way to add this fb_ref attribute to the link sent.
Maybe code is easier to understand than plain text, so here it is:
Here's is the code of the JS call to the send dialog:
FB.ui({
method: 'send',
link: "http://www.example.com/affiliateid/myuseraffiliateid",
to: [11111,22222,33333],
});
With this method, the resultig shared link is equal to the og:url specified (ie http://www.example.com).
And here is the fb:send button which actually works, but without the "to" prepopulated
<fb:send
href="http://www.example.com"
ref="myuseraffiliateid"
></fb:send>
Now, since we've specified a "ref" attribute to the send button, the shared link is "http://www.example.com/fb_ref=myuseraffiliateid".
What I need is to reproduce the ref attribute using fb.ui...
Upvotes: 0
Views: 2165
Reputation: 4528
I finally avoided this issue by using a dynamic og:url in the landing page of the shared link. That's annoying, since I can't count the number of shared links :(
Upvotes: 0
Reputation: 3307
Instead of "example.com/affiliateid=myuseraffiliateid" change your URl structure to "example.com/?affiliateid=myuseraffiliateid".
By doing this, the og:url of the page should remain stable (and consistent with what FB expects) and hence it should work fine.
Upvotes: 3