You can translate the document:

Introduction

LinkedIn is a social media platform mostly used for professional networking. The LinkedIn platform contains APIs for managing advertising, shares and social streams.

The posts of an organization can be analyzed statistically to know how effectively the brand has reached its target. To analyze this, LinkedIn has a Developer API called Marketing Developer Platform. This platform provides various statistical data such as:

  • Follower Statistics
  • Page Statistics
  • Share Statistics

In this document we explain how to use the Denodo Platform to access and integrate this data.

Create an App

  • In order to connect to LinkedIn from an external application we will use OAuth 2.0 as the authentication mechanism.
  • To enable OAuth 2.0 for the LinkedIn account, an application needs to be created by logging in to the Developer API of Linkedin (https://www.linkedin.com/developers/).

  • In the screenshot above we have created an app called Testing_shares.

  • Provide the following information, while creating the app,
  • App Name: Enter a name for your app
  • LinkedIn Page: Enter your company’s LinkedIn page URL or Name.
  • App Logo: Upload the logo.
  • Accept the Legal agreement and click on the Create App button.

OAuth 2.0

Once the app is created. You will see the following tabs,

  • Settings
  • Auth
  • Products
  • Analytics
  • Team members.

The Settings tab allows you to modify the App name and App logo. The Auth tab allows to configure the OAuth settings for the app so external applications can interact with the App.

The Auth tab has three sections,

  • Application Credentials
  • OAuth 2.0 settings
  • OAuth 2.0 scopes

Application Credentials

This section provides the client ID and client secret key details for external applications.

OAuth 2.0 settings

In this section, we will have the TTL for the Access token and the redirect URI for the external application.

In general, the redirect URL must be trusted. In the case of the Denodo Platform, the recommended redirect URL is:

http://localhost:9090/oauth/2.0/redirectURL.jsp

Provide the same and save.

OAuth 2.0 scopes

This section provides information about the scopes of what the external applications can access. The scopes are listed along with its description. Initially, there will be no scopes allocated to a user until the recommended products are added to the created LinkedIn app.

Products

Products help LinkedIn to grant access to apps created by the users. For requests that require Linkedin approval, LinkedIn will send an email to the LinkedIn primary email address, with a link to the Access Request Form. The request is reviewed and will notify you of the decision by email.

Initially, there will be no products added to your app. These products will provide us the scopes or permissions to perform certain actions from the external applications. There are three different products available,

  • Sign In with LinkedIn
  • Share on LinkedIn
  • Marketing Developer Platform

Sign In with LinkedIn

This option helps us to Sign In to the user account from the external applications. Adding this product to the app will authenticate the users to access their LinkedIn profile and retrieve the user ID, First Name, Last Name, and Profile picture. The permissions added will be:

Permission Name

Description

r_liteprofile

Required to retrieve the member's lite profile including their id, name, and profile picture.

r_emailaddress

Required to retrieve the member's email address.

Share on LinkedIn

Share on LinkedIn will help us to share our content directly into the news feed. Members of our LinkedIn page will be able to view the share immediately. The permission added will be:

Permission Name

Description

w_member_socia

Required to create a LinkedIn post on behalf of the authenticated member.

When we select these products to be added to the app, the permissions will be added to the scopes.

Marketing Development Platform

The LinkedIn Marketing Developer Platform allows to manage advertising, shares and social streams.

To enable this product for an App LinkedIn will send a Form that will ask for the details about the organization and the use of the Marketing Development Platform.

Once it is submitted, the LinkedIn team will review the inputs, and based on the inputs provided, the Marketing Development Platform product is enabled for the App. Add your Ad account to the Marketing Development Platform by clicking on the “View Settings” option.

After enabling these products, the scopes for the users will be displayed under the OAuth 2.0 scopes section of Auth tab.

OAuth 2.0 Authentication Credentials

Summarizing, the information needed to connect from an external application to LinkedIn using OAuth will be:

Client Identifier: Obtain this from the Application Credentials of Auth tab.

Client Secret: Obtain this from the Application Credentials of Auth tab.

Token Endpoint URL: https://www.linkedin.com/oauth/v2/accessToken

Authorization Server URL: https://www.linkedin.com/oauth/v2/authorization

Redirect URL: http://localhost:9090/oauth/2.0/redirectURL.jsp

Scopes: r_organization_social, r_1st_connections_size, etc. [Supports scopes available under the OAuth 2.0 scopes section].

Connecting to LinkedIn from the Denodo Platform

Now, let us see how to connect to the LinkedIn API from the Denodo Platform to get the various statistical data of the organization such as Page Statistics, Follower Statistics and Share Statistics.

One of the important parameters to be provided to get the statistics of your organization’s page is the Organization URN, which is the numeric characters present in the LinkedIn page URL. For example,

https://www.linkedin.com/company/<your_company_URN>/admin/

This value is visible if you are the admin of the Organization’s LinkedIn Page.

To retrieve these statistics, one of the mandatory scopes is “rw_organization_admin”. The user connecting must have administrator privilege.

Organization Follower Statistics

The organizationalEntityFollowerStatistics API allows you to retrieve both lifetime and time-bound statistics on followers for an organization.

Lifetime follower statistics: To retrieve lifetime follower statistics, omit the timeIntervals query parameter. The API returns follower counts segmented by various facets such as region and industry.

Time-bound follower statistics: To retrieve time-bound follower statistics include the timeIntervals query parameter. The API returns the aggregate follower count for both paid and organic followers during the days or months of the selected date range, based on the specified timeIntervals.timeGranularityType.

To retrieve the Lifetime Follower statistics of your Organization page, follow the below steps in the Virtual DataPort server,

  • Create a JSON data source by clicking File > New > Data source > JSON.
  • Provide the following information,
  • Name: Name of the data source.
  • Data Route: HTTP Client > Configure

  • In the Authentication tab, obtain the OAuth 2.0 credentials for accessing the LinkedIn App using the credentials provided in the OAuth 2.0 Authentication section.

  • Finally, Test the connection and Save.

Create a Base view to retrieve the follower statistics,

The structure of the base view is in an Array format. You can flatten these arrays as per your requirement.

The output of this base view will be,

The response contains the following details,

Follower Statistics Data Schema

followerCountsByAssociationType

Counts by association type(paid or organic) of the followers

followerCountsByCountry

Counts by country of the followers. The array will contain one item per country

followerCountsByFunction

Counts by the function of the followers. The array will contain one item per function

followerCountsByIndustry

Counts by the industry of the followers. The array will contain one item per industry

followerCountsByRegion

Counts by region of the followers. The array will contain one item per region

followerCountsBySeniority

Counts by the seniority of the followers. The array will contain one item per seniority

followerCountsByStaffCountRange

Counts by staff count range of the current organizations of the followers. The array will contain one item per staff count range

Organization Share Statistics

This endpoint returns organic statistics only.

Lifetime share statistics: To retrieve lifetime share statistics, omit the timeIntervals query parameter. The API returns aggregated stats for an organization's shares.

Time-bound share statistics: To retrieve time-bound share statistics include the timeIntervals query parameter. The API returns aggregate share stats within all of the days or months in between the selected date range based on the specified timeIntervals.timeGranularityType.

The organizationalEntityShareStatistics endpoint returns share data only within the past 12 months, using a rolling 12-month window.

To retrieve the lifetime share statistics, create a JSON Data Source in the Virtual DataPort server by following the steps provided in the Organization Follower Statistics section and use the below URL authenticated by OAuth 2.0,

https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity={organization URN}

Create the Base view over the Share statistics data source,

The JSON response will be,

Share Statistics Data Schema

Field Name

Type

Description

clickCount

long

Number of clicks

commentCount

long

Number of comments

commentMentionsCount

optional long

Number of mentions of the organizational entity in a comment across LinkedIn. The field does not have a value when individual share statistics are requested

engagement

double

Number of organic clicks, likes, comments, and shares over impressions

impressionCount

long

Number of impressions

likeCount

long

Number of likes. This field can become negative when members who liked a sponsored share later unlike it. The like is not counted since it is not organic, but the unlike is counted as organic.

shareCount

long

Number of shares.

shareMentionsCount

optional long

Number of mentions of the organizational entity in a share across LinkedIn. The field does not have a value when individual share statistics are requested.

uniqueImpressionsCount

long

Number of unique impressions.

To retrieve the Statistics of Specific shares, provide the URN of the particular share as shown below,

https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:URN&shares[0]=urn:li:share:URN

Find below the sample response, which shows the total share statistics of that particular share.

Organization Page Statistics

The organizationPageStatistics and brandPageStatistics endpoints allow you to retrieve both lifetime and time-bound statistics on views and clicks for an organization or organization brand page respectively.

Lifetime page statistics: To retrieve lifetime page statistics, omit the timeIntervals query parameter. The API returns view and click statistics segmented by various facets.

Time-bound page statistics: To retrieve time-bound page statistics include the timeIntervals query parameter. The API returns aggregate page statistics within all of the days or months in between the selected date range based on the specified timeIntervals.timeGranularityType.

To retrieve the lifetime page statistics, create a JSON Data source in the Virtual DataPort server by following the steps provided in the Organization Follower Statistics section and use the below URL which should be authenticated through OAuth 2.0,

https://api.linkedin.com/v2/organizationPageStatistics?q=organization&organization={organization URN}

Create base view to retrieve the Page statistics,

The JSON response will be as below,

The Page statistics include Page statistics based on the Mobile view, Desktop view, Jobs Page view, Product page view, etc.

Apart from the Statistical options specified here, there are various statistics that would give more detailed information on Followers, Share, and Page statistics. For this, please refer to the official documentation of LinkedIn.

References

JSON Sources

Authenticating with OAuth 2.0 Overview

Follower Statistics

Page Statistics

Share Statistics

Questions

Ask a question

You must sign in to ask a question. If you do not have an account, you can register here