-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
sidebar_position: 10 | ||
toc_min_heading_level: 2 | ||
toc_max_heading_level: 5 | ||
--- | ||
|
||
# Analytics API Guide | ||
|
||
## Introduction | ||
|
||
To import analytics data, use the Analytics API, following these steps: | ||
|
||
1. Connect the Google Search Console to your Knowledge Graph (Botify is also supported as an alternative to Google Search Console, [inquire with us](https://wordlift.io/contact-us/)). | ||
1. Run the Analytics Import. | ||
|
||
## Authorization | ||
|
||
:::info | ||
|
||
Using the Analytics API requires a WordLift Key. If you're unsure which one is the WordLift Key for an account, go to [my.wordlift.io](https://my.wordlift.io) and scroll through the list of websites. | ||
|
||
::: | ||
|
||
## Connect Google Search Console | ||
|
||
In order to connect the Google Search Console to your Knowledge Graph, a client needs to perform an interactive authentication and authorization process with Google by using a Web Browser. | ||
|
||
### Build Authorization URL | ||
|
||
The process starts using a specially crafted URL. To get the URL use the "Build Authorization URI" API (replace `<key>` with your WordLift Key): | ||
|
||
```sh | ||
curl -X "POST" "https://api.wordlift.io/google-search-console/oauth2/build-authorize-uri" \ | ||
-H 'Authorization: Key <key>' \ | ||
-H 'Content-Type: application/json; charset=utf-8' \ | ||
-d $'{ | ||
"redirect_uri": "https://developers.google.com/oauthplayground" | ||
}' | ||
``` | ||
|
||
:::warning | ||
|
||
The `redirect_uri` must be set to `https://developers.google.com/oauthplayground`. | ||
|
||
::: | ||
|
||
This will yield the following response: | ||
|
||
```json | ||
{ | ||
"authorize_uri": "https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground%2F&prompt=consent&response_type=code&client_id=615875160260-bsbm4u5fb2hrke3ln89n33v8rmmksth9.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fwebmasters.readonly&access_type=offline" | ||
} | ||
``` | ||
|
||
Open the above URL in a Web Browser. | ||
|
||
### Authenticate and Authorize with Google | ||
|
||
When requested provide your Google e-mail address. The account must be able to access the Google Search Console for the target account: | ||
|
||
![Authenticate with Google, by providing your email address](./images/authenticate-with-google.png) | ||
|
||
Then provide the password and complete authentication: | ||
|
||
![Authenticate with Google, by providing your password](./images/authenticate-with-google.png) | ||
|
||
If requested, provide a 2-Step Verification code: | ||
|
||
![Authenticate with Google, by providing a 2-Step Verification code](./images/authenticate-with-google.png) | ||
|
||
Then finally click "Allow" to authorize the Analytics API to access the Google Search Console data: | ||
|
||
![Authorize with Google](./images/authorize-with-google.png) | ||
|
||
After clicking "Allow", the browser is redirected to a URL like this: | ||
|
||
``` | ||
https://developers.google.com/oauthplayground/?code=<authorization-code>&scope=https://www.googleapis.com/auth/webmasters.readonly | ||
``` | ||
|
||
Copy the value in `code=<authorization-code>` (the `<authorization-code>` part) to use it with the Exchange Authorization Code API. | ||
|
||
### |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.7 KB
docs/knowledge-graph/images/authenticate-with-google-password-input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters