& ldquo; Clicks link & rdquo; a Facebook message and how to get its value using the FB Graph API?

advertisements

I have a requirement to pull the 'link clicks' count of a FB page post? What Exactly comes under the 'Link Clicks' count? Is it the number of clicks of the link shared in the FB post or is it something else? What insight metric should we use to get the "link Clicks" of A Facebook Page Post? Please suggest!!


you have posted your question about a year ago, but I want to give some hints, anyway.

This is for the v2.5 api (I am not sure if this also works for v2.3):

for individual clicks:

v2.5/(post-id)/insights/post_consumptions_by_type/lifetime/?fields=values

for amount of individual users who clicked the link:

v2.5/(post-id)/insights/post_consumptions_by_type_unique/lifetime/?fields=values

You should get a result like this:

{
  "data": [
    {
      "values": [
        {
          "value": {
            "video play": 2305,
            "other clicks": 4774,
            "photo view": 58,
            "link clicks": 232
          }
        }
      ],
      "id": "(post-id)/insights/post_consumptions_by_type/lifetime"
    }
  ],
  "paging": {
    "previous": "***",
    "next": "***"
  }
}

Use $result["data"][0]["values"][0]["value"]["link clicks"] to get what you want.

Edit: If there's no link attached to the post the "link clicks" node won't appear. Therefore, assuming you are using php, check isset($result["data"][0]["values"][0]["value"]["link clicks"]) first.

Hope it helps!

Regards!