facebook like: href url vs. canonical url

后端 未结 1 1356
悲哀的现实
悲哀的现实 2020-12-15 07:58

for tracking purposes, I want that the URL, which appears on the facebook stream after an \"like-action\", is slightly different from the URL the user actually liked.

1条回答
  •  有刺的猬
    2020-12-15 08:15

    You can't do exactly what you have requested, but you can still add an arbitrary tracking parameter (especially useful for analytics purposes). Facebook recently added a ref parameter to the fb:like element for this purpose. It's up to you to decide how you want to stuff various bits of information into that single parameter and then parse fb_ref whenever it's included in an incoming URLs.

    Example

    Place the following element on your HTML page:

    
    

    Users clicking the link from Facebook should be directed to:

    http://example.com/test.html?fb_ref=144141&fb_source=home_multiline
    

    Documentation

    • "Adding More Features to the Like Button" blog post
    • fb:like button documentation

    0 讨论(0)
提交回复
热议问题