2. Obtaining headers and cookies

Before starting the data collection, we have to get the headers and cookies that our functions will use to query the API. Please keep in mind that while it might be possible to reproduce these steps with a different browser, we recommend using Firefox to avoid any potential issues.

2.1. Log-In

Log into your LinkedIn account and click on the “Advertising” button in the top right corner.

start_campaign

2.2. Create account

If you don’t already have one, create an Ad Account and then a campaign. Select “Brand awareness” as its objective.

create_campaign

2.3. Open Network options

Open the Network options of Firefox (Ctrl/Cmd + Shift + E) and search for a line with File = campaignManagerAudienceCounts.

Note

If you can’t find it, hone your target audience by selecting an attribute, like their location: this will trigger a query.



find_counts

2.4. Copy headers

Right click on it, then “Copy” -> “Copy Request Headers”. Paste the text into your config file to save it.

copy_headers

2.5. Copy as cURL

On the same line, also do “Copy” -> “Copy as cURL”. Use a service like https://curl.trillworks.com/ to translate the curl syntax into python dictionaries for cookies and headers. Copy and paste the results into your config file.

Done! Make sure you have saved the output of steps 4 and 5 before proceeding to the next step, the data collection!