Как да не загубим броя лайкове при смяна на кода?

dekemvri

Well-Known Member
Ако сменим стария код на лайк бутона за фб, как да избегнем зануляването на броя лайкове?
 
От: Как да не загубим броя лайкове при смяна на кода?

Ако URL-a към който сочи бутона не се променя, не би трябвало да има "зануляване". Обаче, ако искаш да сменяш и URL, няма начин...

Workaround: сложи лайк бутоните да бъдат с новото URL, а на страницата с новото задавай таг og:url със старото урл(този, който е бил преди това). Така може и да стане...


Facebook has a list of required metadata to go with the Like button on your page. One item in this list is called "og:url" and is described as a "canonical" URL. But what does that mean?

The need for a canonical address arises when a web page has more than one address. This usually happens because the page can be customised by appending "parameter" data to its address.

(Look at any web address. If you see a question mark '?' in it, then everything after that mark is parameter data.)

When Facebook is counting "likes" for a page, and the visitors are "liking" it at different page addresses, Facebook has a question; are they looking at the same page? The addresses are different, but does that make the pages different enough to be separately "liked"? Should I combine those votes in a single total?

Facebook expects you, the page designer, to answer that question. Facbook reads the og:url address, and if that "canonical" url is the same, Facebook combines the "likes".

But the og:url is more than just a name for some "likes". Facebook actually goes to the address in og:url when it's looking for the other metadata. Make sure that this canonical address does resolve to the page with the metadata for your button.
Source: http://byrden.com/what-is-a-canonical-url.html
 

Горе