Back to Blog

Connect LinkedIn Ads to BigQuery – Code and No-Code Options Explained

There are different reasons for exporting data from LinkedIn Ads, of which analytics, reporting, and backup are the major ones. In this regard, Google BigQuery is considered the perfect repository for voluminous records since it allows you to not only store data but also query it. In addition, BigQuery can be easily connected to data visualization and business intelligence tools, like Power BI or Google Data Studio. And how can you get your data from LinkedIn Ads to BigQuery? This is what we’re going to explain in this tutorial, so welcome!

What are the options to export LinkedIn Ads data to BigQuery?

LinkedIn Ads does not provide any native or built-in integrations. This means that you will have to rest on either third-party integrations or create your own ones. Another option to transfer LinkedIn Ads data into Google BigQuery is via the manual CSV export. So, this is the list of options that you can use to get data from LinkedIn Ads to BigQuery:

  • Manual – through a CSV file 
  • No-code – using a third-party solution
  • Code – using the LinkedIn Ads API

Let’s check out each of them to decide which option fits your needs the most.

Move data from LinkedIn Ads to BigQuery manually

The idea of this method includes two parts:

  • Download a CSV file from LinkedIn Ads to your computer
  • Upload the CSV file to BigQuery

Download a CSV file from LinkedIn Ads

  • Go to the Campaign Manager and select the account for which you are going to export data.
1.0 campaign manager linkedin ads
  • Click the Export button regardless of the tab you are on – Campaign Groups, Campaigns, or Ads.
1.1 campaign manager linkedin ads export
  • Select the desired report to export, choose the Column view and Time breakdown, then click Export
1.2 campaign manager linkedin ads select report to export
  • Your LinkedIn Ads data will be downloaded to your computer as a CSV file.
1.3 campaign manager linkedin ads export csv

Upload the LinkedIn Ads CSV file to Google BigQuery 

To upload CSV files to BigQuery, you need to have a BigQuery project with a dataset in it. If you don’t have those created, check out our BigQuery setup guide. It also contains the explanation of how to upload CSV data to BQ, but we’ll recap this here as well:

  • Open your BQ dataset and click Create Table.
2.0 bigquery create table button
  • Configure the table as follows:
    • Create table from – choose Upload.
    • Select file – click Browse and select the CSV file exported from LinkedIn Ads.
    • File format – it should be detected automatically, but if not, choose CSV.
    • Table – enter the name of your table
    • Schema – check Auto-detect.
2.1.1 bigquery table configuration

There are also advanced options that you may need to set. For example, in our case, we needed to skip 4 header rows.

2.1.2 bigquery table configuration

Once ready, click Create table, and welcome your LinkedIn Ads data in BigQuery.

2.2 bigquery table created

This is the simplest way to send LinkedIn Ads data to Google BigQuery. However, it has one significant drawback – it’s manual. Your campaigns are running which means they generate more and more data. So, to keep your data in BigQuery up-to-date, you need to download and upload CSV files from LinkedIn ads again and again. This could take minutes, hours, and even days of your time over the long term. Having said that, you can automate data refresh on a schedule like every day or every hour to get rid of any manual work. For this, you need to connect LinkedIn Ads to BigQuery using either a third-party solution or coding. 

LinkedIn Ads to BigQuery without coding

So, the idea is to find a LinkedIn Ads to BigQuery integration or connector that will let you set up ETL dataflow without any coding. Such connectors are provided by different solutions including Coupler.io, Hevodata, Supermetrics, Stitch, Owox, and so on. They differ in pricing, features provided, frequency of data refresh, and other parameters. What benefits can they give you compared to the plain CSV export from LinkedIn Ads? 

  • Direct data flow from LinkedIn Ads to BigQuery
  • Data refresh on a schedule
  • Support of other apps to load data from
  • Data transformation options (filtering, querying, stitching, etc.)
  • And so on.

If you want to automate exports of data from LinkedIn Ads to Google BigQuery, we think you’ll love the upcoming Coupler.io importer. It’s a no-code solution that takes less than 5 minutes to set up. Then, your ads data will be flowing into your BigQuery tables with the frequency you choose, even up to every 15 minutes! 

Figure 1.1. Coupler.io is a solution to import data to Google Sheets Excel or BigQuery from different sources

The LinkedIn importer by Coupler.io is in the final stages of development and we plan to release it in early October 2022. In the meantime, feel free to try out Coupler.io on a free 14-day trial. Among the available BigQuery integrations, you will find Facebook Ads and Google Ads, Pipedrive, and many other sources. The logic of all importers is the same:

  1. You need to connect to your source app account and select the data you want to export. For some sources, you can also use queries or filters.
  2. Then you need to connect to your destination app account. Currently, there are three destinations available: Google BigQuery, Google Sheets, and Microsoft Excel. Specify the table or the spreadsheet where to export your data.
  3. The final step is to automate your exports. For this, you need to enable the Automatic data refresh and customize the frequency for it. 
4 xero bigquery importer example

Once you click Save and Run, the data will flow from your source app to the destination app on the schedule you set.

If the no-code solution does not work for you, you can always connect LinkedIn Ads to BigQuery via the API. However, this journey won’t be that easy.

Load data from LinkedIn Ads to Google BigQuery via the API

To connect LinkedIn Ads to BigQuery via the API, you need to write a script that will:

  1. Fetch specific data in JSON format via the LinkedIn API. 
  2. Upload this data to BigQuery using the BigQuery API.

We’ve already blogged about the second part in How to CRUD BigQuery with Python. As for the first part, you can even do it without coding if you use an API connector like JSON by Coupler.io. Regardless of the code or no-code connection option you go with, you’ll need to get access to the LinkedIn API. For this, a few manipulations are needed:

  • Create a LinkedIn app
  • Get access to LinkedIn Marketing APIs 
  • Generate an access token

Let’s go through each step in detail.

Create a LinkedIn app

  • Go to your LinkedIn Developer account and click Create app.
3.0 linked in create app
  • Enter the app name, specify the LinkedIn company page, and add the logo for your app. Agree to the API legal terms. Then, click Create app.
3.1 create app required fields 1
  • Congrats! Your LinkedIn app is now created.
3.2 created linkedin app

Get access to LinkedIn Marketing APIs 

  • On the Products tab, go to Marketing Developer Platform and click Request access.
3.3 linkedin app marketing developer platform request access
  • You will need to fill in an access request form with details about your company’s use case. Beware that LinkedIn grants access to apps that have product-relevant use cases, others will be rejected.
3.4 linkedin app marketing developer platform request access
  • A link to the access request form will show up in a few minutes.
3.5.1 linkedin app marketing developer platform request access
  • Once it is available, it will look like this:
3.5.2 linkedin app marketing developer platform request form link
  • Follow the link and fill in the required fields of the form. 
3.5.3 linkedin app marketing developer platform request form
  • Click Submit to submit the form and wait for the access to the Marketing Developer Platform.
3.5.4 linkedin app marketing developer platform request form

Generate an access token

You should proceed to this step no earlier than your access to the Marketing Developer Platform is confirmed. Your Products section on the Marketing Developer Platform should look like this:

3.6 linkedin app marketing developer platform
4.0 linkedin app credentials

You’ll need this information to get a LinkedIn token using Postman, a useful no-code tool to work with APIs. Navigate to LinkedIn’s public Postman workspaces.

4.1 linkedin public postman workspaces
  • You will see a list of collections, Audiences, Campaign Management, Content APIs, etc. Each collection will have an environment it should be used with. You need to fork the required collection and relevant environment of interest. To do this, click the Click me link for the chosen collection. Then specify the Fork label and choose the workspace. Click Fork Collection.
4.2 linkedin public postman workspaces fork collection
  • You’ll get to Postman’s Get New Access Token request.
4.3 linkedin public postman workspaces
  • Make sure it to have the following parameters:
Grant TypeAuthorization Code
Callback URLCheck Authorize using browser
Auth URLhttps://www.linkedin.com/oauth/v2/authorization
Access Token URLhttps://www.linkedin.com/oauth/v2/accessToken
Client ID{insert your client ID}
Client Secret{insert your client secret}
Scoper_basicprofile, r_organization_social,rw_ads, r_ads_reporting, r_ads, w_organization_social, w_member_social, r_1st_connections_size, rw_organization_admin
Client AuthenticationSend client credentials in body 

Click Get New Access Token – you will then see the LinkedIn authorization page where you will need to grant some permissions to your LinkedIn app. 

4.4 linkedin ads app authorization

Note: If you are not logged in to LinkedIn, you’ll need to do this first. 

  • Click Allow and get back to Postman – here is your access token.
4.5 linkedin ads access token

With the access token obtained, you can send GET requests to the LinkedIn API to export the required data. For this, you need to know endpoints that are associated with specific data entities. You can learn more about the information you can retrieve and the respective endpoints in the LinkedIn Marketing Developer platform documentation.

Let’s check out an example of how it works.

Example of loading data from LinkedIn Ads to BigQuery

We told you that we’d show you how you can connect BigQuery to the LinkedIn API without coding. For example, let’s export information about a certain group of campaigns from LinkedIn to BigQuery. 

  • Sign in to Coupler.io, click Add new importer and choose JSON as a source app and BigQuery as a destination app. Click Proceed.
5.0 json bigquery
  • Insert the API URL to the JSON URL field. It consists of the base LinkedIn Ads URL and the endpoint. In our example, this is 
https://api.linkedin.com/v2/adCampaignGroupsV2/{ad-campaign-group-id}
5.1 json url0linkedin ads
  • Add the following header to authorize your request:
Authorization: Bearer {your-access-token}
5.2 request header authorization

JSON importer by Coupler.io also allows you to specify query parameters, select columns, and use the Path parameter. You may need this for other endpoints. In our example, we don’t need them. So, we can jump to the destination section.

  • Connect your BigQuery account, then specify the dataset and a table to load the LinkedIn Ads data to. 
5.3 bigquery destination linkedin ads
  • If you want, you can automate exports of data from LinkedIn Ads to BigQuery on a schedule. For this, toggle on the Automatic data refresh and customize the wanted frequency.
12. Coupler.io scheduling

Eventually, click the Save and Run button to export your data. There you go. 

5.4 bigquery destination linkedin ads results

This way you can automate exports of different data from LinkedIn Ads to BigQuery.

What’s the best way to sync LinkedIn Ads to BigQuery?

For many, third-party integration is the best way to connect LinkedIn Ads to BigQuery. Most provide you with the out-of-the-box ETL solution. This means that you can automate exports of data from LinkedIn Ads to Google BigQuery with just a few clicks that will take not more than a couple of minutes. 

On the other hand, if you do not have any recurring exporting purposes, the simple native export from LinkedIn Ads will do. It’s plain and simple, and won’t cost you a penny.

As for the API, it would be the choice for the bravest category of users. You can do this without coding using the JSON importer by Coupler.io. If you have coding skills and can build a LinkedIn to BigQuery integration from scratch, you may bump into the thorny process of getting access to the LinkedIn Developer Platform. Think twice before you make your choice for this option.

Now you know the truth so it’s up to you what you’ll do with it. Good luck with your data!

Back to Blog

Comments are closed.

Focus on your business
goals while we take care of your data!

Try Coupler.io