2 Facebook like buttons for same URL, with different get variables, seeing the same like count?

2k Views Asked by At

I generate a unique variable for each user on my site that is built into their referral link. When I put that link into a facebook like button the like count is separate for each link.

Here is my example:

UserA:

<div class="fb-like" data-href="http://example.com?refer=3323"></div>

User B:

<div class="fb-like" data-href="http://example.com?refer=2355"></div>

Both users effectivly have the same link, but just a different referral code. I want them both to see our example.com 'like count' but instead, each sees '0 likes.'

Is it possible to have them both see the same like count? If so, how?

4

There are 4 best solutions below

0
On BEST ANSWER

You may use Facebook's fb_ref parameter:

<fb:like ref="top_left"></fb:like>

Or in iframe notation:

<iframe src="...&ref=top_left"></iframe>

When a reader clicks through Facebook back to your website, Facebook creates this link on the fly:

*http://www.facebook.com/l.php?fb_ref=top_left&fb_source=profile_oneline*

So in your case use this as your Like configuration:

<fb:like ref="3323"></fb:like>

or this:

<fb:like ref="refer-3323"></fb:like>

What you get back is: fb_ref="3323" or fb_ref="refer-3323", respectively. It should be feasible for you to convert this into your desired reflink.

This is untested, but well documented: https://developers.facebook.com/docs/reference/plugins/like/

0
On

Go to the debugger

Make sure the two urls have the same og:url, aka. the canonical url.

0
On

The URL used in the Like plugin should be common [for all users]. Then only the like count will be displayed as you expect.

In the code above, its different for User A and User B. Instead you just specify the data-href as 'http://example.com'.

May I know why you have specified the referral ID in the url?

0
On

This is sort of a wanker way around it but I used the HTML5 code for one and the iFrame for the second.

https://developers.facebook.com/docs/plugins/like-button/