Your browser is out of date. The site might not be displayed correctly. Please update your browser.

Knowledge Base
SEMrush Toolkits
SEO Toolkit
Traffic Analytics
How to Export Traffic Analytics data to Google Sheets using API

How to Export Traffic Analytics data to Google Sheets using API Question

This article will show you how to export Traffic Analytics data to Google Sheets using the Traffic Analytics API.

To acquire the Traffic Analytics API, please contact our sales team, as it is separate from a standard SEMrush subscription and cannot be purchased online.

Once the Traffic Analytics API is added to your account, you will have the ability to pull our raw Traffic Analytics data directly into Google Sheets, among other applications. Simply follow these steps:

First, make a copy of this Google Sheet template.

Now, add your API key into cell B4.

api-google-sheet

Once your API key is entered, you can enter any domain into cells A6 or A7 and the sheet will populate the data throughout the row.

api-data

If you want to pull information on more than 2 domains, you’ll need to copy the code in cell B6 and B7, paste it in the cell below and change

copy-api-codeIf copied correctly, you will see this “Missing mandatory domains param” message until you enter a domain.
 

missing-paramsEnter a new domain in the first column and it will populate. Label the columns based on the order they are listed in cell B3 so you know what each number is referencing like so:

label-columns

To change the date to a historical data point, write your desired month in column B1.

To change the country, enter the country code in B2. If this cell is blank, it will present global data.

To customize the data you want to pull, edit the preset columns listed in B3.

Information for country code and export column options can be found in the Traffic Analytics API documentation.