By Rudderstack Team

How to load data from the LinkedIn Ads to MS SQL Server

This post helps you with loading your data from LinkedIn Ads to MS SQL Server. If you are looking to get analytics-ready data without the manual hassle you can integrate LinkedIn Ads to MS SQL Server with RudderStack, so you can focus on what matters, getting value out of monitoring your digital marketing spending and performance data.

Access your data on LinkedIn Ads

The first step in loading your LinkedIn Ads data to any kind of data warehouse solution is to access your data and start extracting it.

Using the REST API that LinkedIn Ads offers, you can programmatically interact with your account to gain access to your digital advertising data. By doing so you can get aggregated metrics that, among others, include the following:

  1. Counts of the clicks on the action button and the ad unit
  2. The number of impressions or clicks for each card of the carousel ad and creative landing page clicks.
  3. Count of comments and of likes on each comment
  4. Value of conversions and cost in the account’s local currency.
  5. All the available aggregated metrics can be retrieved for any user-defined time period.

In addition to the above, the things that you have to keep in mind when dealing with the LinkedIn Ads API are:

  • Rate limits. There are daily request Quotas per application, per user, and per-application developer as described in the documentation. These vary depending on the Application tier. Current day’s usage and limits can be found in the application (choose application → Application Settings → Usage & Limits)
  • Authentication. Linkedin uses OAuth for authentication. An access token is valid for 60 days. Adding the access token to the requests’ header (bearer authorization) is sufficient in order to get the reports.
  • Pagination. API endpoints that return a collection of items are always paginated.

About LinkedIn Ads

LinkedIn Ads is an advertising platform that enables businesses to reach their ideal customers on the world’s largest professional network, consisting of more than 560 million users. By using LinkedIn Ads you can effectively:

  1. Increase awareness of your products and services
  2. Lure potential users to click on a new page on your website
  3. Attract new followers to your company’s company page, thus increasing its visibility

Additionally, LinkedIn allows getting pretty smart about targeting the right audiences by aiming at specific company size, job title, industry, and geographic location. This granularity enables you to reach people and companies that matter to your business easily.

Regarding the different types of ads that LinkedIn currently supports, the options are quite many:

  • Sponsored Content: used for promoting content from your company’s page
  • Direct Sponsored Content: used for promoting personalized content without having to publish it on your company’s page.
  • Sponsored InMail: allows you to deliver personalized private messages to potential customers.
  • Text Ads: Just like with other advertising platforms like Google and Bing, these ads are placed on the right rail of the news feed page and are available only on the desktop version.
  • Dynamic Ads: refers to dynamically generated, highly personalized ads that drive users to your company page or apply to a job post.
  • Lead Gen Forms: refers to prefilled forms with user’s LinkedIn information to generate quality leads.

Transform and prepare your LinkedIn Ads data

After you have accessed your data on LinkedIn Ads, you will have to transform it based on two main factors,

  1. The limitations of the database that the data will be loaded onto
  2. The type of analysis that you plan to perform

Each system has specific limitations on the data types and data structures that it supports. If you want to push data into Google BigQuery, you can send nested data like JSON directly.

Additionally, you have to choose the right data types. Again, depending on the system you will send the data to and the data types that the API exposes to you, you will have to make the right choices. These choices are important because they can limit the expressivity of your queries and limit your analysts on what they can do directly out of the database.

Also, you have to consider that the reports you’ll get from LinkedIn Ads are like CSV files in terms of their structure, and you need to identify somehow what and how to map to a table into your database.

Load your LinkedIn Ads data into Microsoft SQL Server

So, after you have managed to access your data on LinkedIn Ads and you have also figured out the structure that the data will have on your database, you need to load the data into the database, in our case, into a Microsoft SQL Server.

As a feature-rich and mature product, MS SQL Server offers a large and diverse set of methods for loading data into a database. One way of importing data into your database is by using the SQL Server Import and Export Wizard. With it and through a visual interface, you will be able to bulk load data from a number of supported data sources.

Another way for importing bulk data into an SQL Server, both on Azure and on-premises, is by using the BCP utility. This command-line tool is built specifically for bulk loading and unloading of data from an MS SQL database.

Finally and for compatibility reasons, especially if you manage databases from different vendors, you can BULK INSERT SQL statements.

Similarly, and as it happens with the rest of the databases, you can also use the standard INSERT statements, where you will be adding data row-by-row directly to a table. It is the most basic and straightforward way of adding data into a table, but it doesn’t scale very well with larger datasets.

Updating your LinkedIn Ads data on MS SQL Server

As you will be generating more data on LinkedIn Ads, you will need to update your older data on an MS SQL Server database. This includes new records and updates to older records that have been updated on LinkedIn Ads for any reason.

You will need to periodically check LinkedIn Ads for new data and repeat the process that has been described previously while updating your currently available data if needed. Updating an already existing row on a SQL Server table is achieved by creating UPDATE statements.

Another issue that you need to take care of is identifying and removing any duplicate records on your database. Either because LinkedIn Ads does not have a mechanism to identify new and updated records or because of errors on your data pipelines, duplicate records might be introduced to your database.

In general, ensuring the quality of the data that is inserted in your database is a big and difficult issue, and MS SQL Server features like TRANSACTIONS can help tremendously. However, they do not solve the problem in the general case.

The best way to load data from LinkedIn Ads to MS SQL Server

So far we just scraped the surface of w