Target Audience Count in LinkedIn API

前端 未结 1 695
臣服心动
臣服心动 2021-01-27 00:37

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 us

相关标签:
1条回答
  • 2021-01-27 01:36

    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

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