Detailed graphic tutorials on Baidu Statistics configuration include siteId, Baidu Statistics AccessToken, and Baidu Statistics code acquisition step tutorials.

I. Introduction

Many netizens and developers don’t know how to obtain Baidu Statistics siteId and Baidu Statistics token. The tutorials found on the Internet are all old tutorials from a few years ago, so I will give you a detailed issue to obtain Baidu Statistics siteId, Baidu Statistics token, and Baidu Statistics code. Detailed step-by-step tutorial.

2. Log in to Baidu Statistics

1.1 Log in to Baidu Statistics official website

Just log in with your personal account

1.2 Add statistics site

Enter the navigation bar and use Settings--Website List--Add your own site information

1.3 Obtain statistical code

Just copy the configuration to your own website system

1.4 Get API

There are requirements for first-time addition and use. Complete the corresponding site PV requirements on the first day, and it can be activated on the second day (usually there will be a delay of several hours)

By activating the data export service, Baidu Statistics Tongji API can provide website users with a convenient channel to obtain website traffic data.

This allows website users to provide data analysis, operation monitoring, website promotion and other services to the website account.

1.5 Get siteId

In the website profile, you can get siteId= in the address bar.

1.6 Obtain Baidu Statistics token

There are official documentation for token acquisition. You can refer to my detailed graphic tutorial.

To call the API interface of Baidu account, the user needs to pass the identity verification of Baidu Developer Center. The specific steps are as follows:

1.6.1 ObtainAPI Key

Enter the Baidu account login page through the following URL. The login account here is the account you use to log in to Baidu Statistics to view report data. After the login is completed, you will jump to the page to obtain the code.

 http://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri=oob&scope=basic&display=popup

in:

  • {CLIENT_ID}fill in yourAPI Key

1.6.2 GetACCESS_TOKEN

Get via authenticationACCESS_TOKEN

After the user agrees to the authorization, he will be redirected to an obtained CODEpage. After copying CODEthe value, you can add it to the following URL in exchange ACCESS_TOKEN :

http://openapi.baidu.com/oauth/2.0/token?grant_type=authorization_code&code={CODE}&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&redirect_uri=oob

in:

  • {CLIENT_ID}fill in yourAPI Key
  • {CLIENT_SECRET}fill in yourSecret Key
  • {CODE}Fill in theCODE

Get return data

{
    "expires_in": 2592000,
    "refresh_token":"2.385d55f8615fdfd9edb7c4b5ebdc3e39.604800.1293440400-2346678-124328",
    "access_token":"1.a6b7dbd428f731035f771b8d15063f61.86400.1292922000-2346678-124328",
    "session_secret":"ANXxSNjwQDugf8615OnqeikRMu2bKaXCdlLxn",
    "session_key":" 248APxvxjCZ0VEC43EYrvxqaK4oZExMB",
    "scope":"basic"
}

You can also see it directly in the address bar of the web page.ACCESS_TOKEN

Completed, you can get ACCESS_TOKENthe next API request.

3. Test the effect of use

The SparkAi system is used here for testing. Regarding the SparkAi system, you can read my blog introduction:

SparkAi system deployment and construction document SparkAi system deployment and construction document icon-default.png?t=N7T8https://www.idcyli.com/33.html The configuration is connected here, let’s take a look at the effect.

The Access Token is valid for one month. After it expires, just install the above tutorial to obtain it again.

Guess you like

Origin blog.csdn.net/weixin_43227851/article/details/133419889