In this article, we will collect a dashboard for SEO traffic analytics. We will unload the data through python scripts and through .csv files.
What will we unload?
To analyze the dynamics of the positions of search phrases, you will need to unload from
Yandex.Webmaster and
Google Search Console . To assess the "usefulness" of pumping the position of the search phrase, frequency data will be useful. They can be obtained from
Yandex.Direct and
Google Ads . Well, to analyze the behavior of the technical side of the site, we will use
Page Speed Insider .
SEO traffic dynamics
Google search console
To interact with the API, we will use the
searchconsole library. The github describes in detail how to get the necessary tokens for login. The procedure for uploading data and loading it into the MS SQL database will be as follows:
def google_reports():
Yandex.Webmaster
Unfortunately, the Webmaster can only upload 500 search phrases. Upload cuts by country, device type, etc. he can't either. Due to these restrictions, in addition to uploading positions for 500 words from the Webmaster, we will upload data from Yandex.Metrica to landing pages. For those who do not have many search phrases, 500 words will be enough. If your semantic core according to Yandex is wide enough, you will have to unload positions from other sources or write your position parser.
def yandex_reports(): token = "..."
Page Speed Insider
Allows you to evaluate the download speed of site content. If the site began to load more slowly, then this can significantly reduce the position of the site in search results.
Google Ads and Yandex.Direct
To estimate the frequency of search queries, we unload the frequency of our SEO core.
Yandex budget forecast
Google Keyword Planner
Yandex Metric
Upload data on views and visits to login pages from SEO traffic.
token = token headers = {"Authorization": "OAuth " + token} now = datetime.now() fr = (now - timedelta(days = 9)).strftime("%Y-%m-%d") to = (now - timedelta(days = 3)).strftime("%Y-%m-%d") res = requests.get("https://api-metrika.yandex.net/stat/v1/data/?ids=ids&metrics=ym:s:pageviews,ym:s:visits&dimensions=ym:s:startURL,ym:s:lastsignSearchEngine,ym:s:regionCountry,ym:s:deviceCategory&date1={0}&date2={1}&group=all&filters=ym:s:lastsignTrafficSource=='organic'&limit=50000".format(fr,to), headers=headers) a = json.loads(res.text) re = pd.DataFrame(columns=['page', 'device', 'view', 'dt_from', 'dt_to', 'engine', 'visits', 'country', 'pageviews']) for i in a['data']: temp={} temp['page'] = i['dimensions'][0]['name'] temp['engine'] = i['dimensions'][1]['name'] temp['country'] = i['dimensions'][2]['name'] temp['device'] = i['dimensions'][3]['name'] temp['view'] = i['metrics'][0] temp['visits'] = i['metrics'][1] temp['pageviews'] = i['metrics'][0] temp['dt_from'] = fr temp['dt_to'] = to re=re.append(temp, ignore_index=True) to_sql_server(re, 'yandex_pages')
Data Acquisition in Power BI
Let's see what we managed to unload:
- google_positions and yandex_positions
- google_frequency and yandex_frequency
- google_speed and yandex_speed
- yandex_metrika
From this data we will be able to collect dynamics by week, by segment, general data by segments and requests, dynamics and general data by pages and speed of loading content. This is what the final report might look like:
On the one hand, there are a lot of different signs and it is difficult to understand what are the general trends. On the other hand, each plate displays important data on positions, impressions, clicks, CTR, page load speed.
Articles from the cycle: