Target Audience Count in LinkedIn API

穿精又带淫゛_ 提交于 2021-02-05 08:25:28

问题


LinkedIn API v1 had an api endpoint to count the number of selected target audience. The later apis has this endpoint only for Ads-API

Now, I am trying to share posts using targeting criteria (Share API). I want to restrict posting if size of audience is less than 300. (As LinkedIn has a limit (audience size must be at least 300), I have to do a check first.) how do I count the size of target? (Note that, I have the count of individual categories with this endpoint: but these audiences might have intersection, so the sum of these counts aren't accurate.)

How does others use targeting api without this? Or am I missing something?


回答1:


You can use the Audience Counts API, where you can pass the targetingCriteria as a list, as example:

curl \
   -H "Authorization:Bearer <the_token>" \
   -H "Content-Type:application/json" \
   -H "X-Restli-Protocol-Version: 2.0.0" \
   "https://api.linkedin.com/v2/audienceCountsV2?q=targetingCriteriaV2&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AinterfaceLocales:List(urn%3Ali%3Alocale%3Aen_US))),(or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Aregion%3A5636))))))"

Will return something like:

{
  "elements": [
    {
      "total": 1100000,
      "active": 0
    }
  ],
  "paging": {
    "count": 10,
    "start": 0,
    "links": []
  }
}

Take care of the correct encoding as described in the doc also.

UPDATE

In order to calculate organic post on a companyPage, you should add the followedCompanies criteria, as described in the doc here:

The audience you target for your share must be greater than 300 members. Use the audienceCountsV2 API to calculate the approximate size of your audience. Make sure to pass in your company URN in the followedCompanies field of the targetingFacet parameter so your audience count will be filtered down to only members who follow your company.

So referring to the previous example, for targeting a companyPage of ID = 123:

curl \
   -H "Authorization:Bearer token" \
   -H "Content-Type:application/json" \
   -H "X-Restli-Protocol-Version: 2.0.0" \
   "https://api.linkedin.com/v2/audienceCountsV2?q=targetingCriteriaV2&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AfollowedCompanies:List(urn%3Ali%3Aorganization%3A123))),(or:(urn%3Ali%3AadTargetingFacet%3AinterfaceLocales:List(urn%3Ali%3Alocale%3Aen_US))),(or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Aregion%3A5636))))))"

Hope this help



来源:https://stackoverflow.com/questions/59944928/target-audience-count-in-linkedin-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!