GithubHelp home page GithubHelp logo

chiogros / linkedin-connectors-for-gdatastudio Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 52 KB

A set of connectors for Google Data Studio to fetch data from LinkedIn API.

License: GNU Affero General Public License v3.0

JavaScript 100.00%
linkedin connector datastudio

linkedin-connectors-for-gdatastudio's Introduction

LinkedIn connectors for GDataStudio

Google Data Studio connectors to fetch data from LinkedIn Marketing API.

Connectors organization

There is a main connector called Core: it retrieves and handles data to bring it properly for GDS and it also sets the authentication method. Children connectors (like Company-followers) use Core functions and use specific functions they have for their API endpoint.

How to use them on GDS

Setup Core connector

  1. Go to Google Apps Script
  2. Create a new project
  3. Name it
  4. Go to project settings
  5. Check Display appsscript.json manifest file
  6. Take note about Script ID (useful for children connectors)
  7. Go back to code window
  8. Create files and set code for Core connector

Setup child connector

  1. Go to Google Apps Script
  2. Create a new project
  3. Name it
  4. Go to project settings
  5. Check Display appsscript.json manifest file
  6. Go back to code window
  7. Create files and set code for the child connector
  8. In appsscript.json, change Dependencies > Libraries > LibraryID to the Core script ID you took note
  9. Deploy it (easiest by going through Use old editor button > Publish > Publish from manifest file)

Use connectors in GDS

  1. Go to Google Data Studio
  2. Create > Data source
  3. Search for your deployed child connector
  4. Fill credentials
  5. Now you can import it in your GDS reports

Get access token

  1. Create a LinkedIn developer account
  2. Create an LinkedIn app
  3. When you're on your app overview, go to Products tab and add Marketing Developer Platform product
  4. Go to Auth tab and set an Authorized redirect URLs for your app like https://access_token. It will be useful to get back your access token
  5. Take note of the Client ID and Client secret codes
  6. Execute this request to get a first token. You have to set client_id ; if needed you could change scope and change redirect_url to another redirect URL (that URL must match with the one set though step 4, and it must be encoded)
  7. Execute this to get a 60 days token. You have to change code to the token you got step 6, set client_id and client_secret. If needed, change redirect_url like step 6
  8. Use the latter token to fill connector credentials

How to create a new LinkedIn connector

First, copy Company-followers connector as template.

You can find the Marketing product documentation here.

Then you have 3 things to change:

  1. Change endpoint global var to the GET method you want and the parameters.
// core.gs
var endpoint = ['networkSizes/urn:li:organization:', '?edgeType=CompanyFollowedByMember'];
  1. Put fetchable fields from API
// fields.gs
function getFields(request) {
  var fields = cc.getFields();
  var types = cc.FieldType;
  var aggregations = cc.AggregationType;

  fields.newMetric()
    .setId('LinkedIn_company_followers')
    .setType(types.NUMBER); // BOOLEAN, NUMBER, ...
    
  fields.newDimension()
    .setId('Users-followers_field_example')
    .setType(types.TEXT); // BOOLEAN, NUMBER, ...
  
  // put all fetchable fields
  
  return fields;
}
  1. Handle each data row
// dataHandler.gs
function responseToRows(requestedFields, response) {

  var rows = new Array();

  var fields = requestedFields.asArray();
  
  // Filter for requested fields
  fields.forEach(function (field) {
    
    switch (field.getId()) {
      case 'LinkedIn_JSON_index_name':
        rows.push(response.JSON_index_name);
        break;
      default:
        break;
    }
  });

  return rows.map(function(row) {
    return { values: [row] };
  });
  
}

linkedin-connectors-for-gdatastudio's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

good886

linkedin-connectors-for-gdatastudio's Issues

Step 8 in Instructions Question

Hello Chiogros, thanks a lot for building this tool!

I am new to both GDS and Apple Script, and I was getting stuck at step 8 of your instructions "8. Create files and set code for Core connector"

Do you have more info on what exact files to create where and what "set code for Core connector" entails? Perhaps you have a simple screenshot?

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.