Statistics and Analytics

Webmaster Tools

Google Webmaster Tools

Set the verification string of Google Webmaster Tools which is used in submitting sitemap.

Login to Google Webmaster Tools and go to verification methods and choose HTML Tag, you will get some code:

<meta name="google-site-verification" content="XXXXXXXXXXXXXXXXXXXXXXX" />

Copy XXXXXXXXXXXXXXXXXXXXXXX value of content key.
Edit theme config file and add or change google_site_verification section:

next/_config.yml
google_site_verification: XXXXXXXXXXXXXXXXXXXXXXX

Bing Webmaster Tools

Set the verification string of Bing Webmaster Tools which is used in submitting sitemap.

Login to Bing Webmaster Tools and go to verification methods and choose HTML Tag, you will get some code:

<meta name="msvalidate.01" content="XXXXXXXXXXXXXXXXXXXXXXX" />

Copy XXXXXXXXXXXXXXXXXXXXXXX value of content key.
Edit theme config file and add or change bing_site_verification section:

next/_config.yml
bing_site_verification: XXXXXXXXXXXXXXXXXXXXXXX

Yandex Webmaster Tools

Set the verification string of Yandex Webmaster Tools which is used in submitting sitemap.

Login to Yandex Webmaster Tools and go to verification methods and choose Meta Tag, you will get some code:

<meta name="yandex-verification" content="XXXXXXXXXXXXXXXXXXXXXXX" />

Copy XXXXXXXXXXXXXXXXXXXXXXX value of content key.
Edit theme config file and add or change yandex_site_verification section:

next/_config.yml
yandex_site_verification: XXXXXXXXXXXXXXXXXXXXXXX

Baidu Webmaster Tools

Set the verification string of Baidu Webmaster Tools which is used in submitting sitemap.

Login to Baidu Webmaster Tools and go to verification methods and choose HTML Tag, you will get some code:

<meta name="baidu-site-verification" content="XXXXXXXXXXXXXXXXXXXXXXX" />

Copy XXXXXXXXXXXXXXXXXXXXXXX value of content key.
Edit theme config file and add or change baidu_site_verification section:

next/_config.yml
baidu_site_verification: XXXXXXXXXXXXXXXXXXXXXXX

Analytics Tools

Google Analytics

  1. Create an account and log into Google Analytics. More detailed documentation
  2. Edit theme config file and change section google_analytics to your Google track ID. Google track ID always starts with UA-.
    next/_config.yml
    # Google Analytics
    google_analytics: UA-XXXXXXXX-X

Azure Application Insights

  1. Create an account and log into Application Insights. More detailed documentation
  2. Edit theme config file and change section application_insights to your instrumentation key.
    next/_config.yml
    # Application Insights
    application_insights:

Baidu Analytics (China)

Login to Baidu Analytics and locate to site code getting page.

Copy the script ID after hm.js?, like the following picture:
NexT Baidu Analytics

Edit theme config file and change section baidu_analytics to your script ID.

next/_config.yml
# Baidu Analytics ID
baidu_analytics: your_id

Tencent Analytics (China)

  1. Please login to Tencent Analytics and get your ID.
  2. Then put it into tencent_analytics section of theme config file.

    next/_config.yml
    # Tencent analytics ID
    tencent_analytics: your_id

Tencent Mobile Analytics (China)

  1. Create an account and log into Tencent Mobile Analytics. More detailed documentation
  2. Edit theme config file and fill section tencent_mta.
    next/_config.yml
    # Tencent MTA ID
    tencent_mta: your-tencent-mta-id

CNZZ Analytics (China)

  1. Create an account and log into CNZZ Analytics. More detailed documentation
  2. Set the value of section cnzz_siteid in theme config file to your CNZZ site ID. You can find this ID in link or the auto-generated script.
    next/_config.yml
    # CNZZ count
    #cnzz_siteid:

The script will show «Webmaster Statistics» and it's ugly, so I used a display: none; to hide it.

Counting Tools

Firebase

Firebase Analytics provides the functionality of visitor statistics.

Login to Firebase to get apiKey and projectId. More detailed documentation

Edit theme config file and add or change firestore section:

next/_config.yml
firestore:
enable: false
collection: articles #required, a string collection name to access firestore database
apiKey: #required
projectId: #required
bluebird: false #enable this if you want to include bluebird 3.5.1(core version) Promise polyfill

Busuanzi Counting (China)

Edit busuanzi_count option in theme config file.
When enable: true, global setting is enabled. If site_uv, site_pv, page_pv are all false, Busuanzi only counts but never shows.

When site_uv: true, it will show site UV in footer.
site_uv_header and site_uv_footer is custom style words, and you can hide it by leaving it blank. You can also use font-awesome, it looks like [site_uv_header]UV count[site_uv_footer].

next/_config.yml
# View: Site visited by 12345 people.
site_uv: true
site_uv_header: Site visited by
site_uv_footer: people.

When site_pv: true, it will show site PV in footer.
site_pv_header and site_pv_footer is custom style words, and you can hide it by leaving it blank, you can also use font-awesome, it looks like [site_pv_header]PV count[site_pv_footer].

next/_config.yml
# View: Site visited by 12345 times.
site_pv: true
site_pv_header: Site visited by
site_pv_footer: times.

When page_pv: true, it will show page PV under post title.
page_pv_header and page_pv_footer is custom style words, and you can hide it by leaving it blank, you can also use font-awesome, it looks like [page_pv_header]PV count[page_pv_footer].

next/_config.yml
# View: Post read by 12345 times.
page_pv: true
page_pv_header: Post read by
page_pv_footer: times.

LeanCloud (China)

Adding article reading times counting to NexT theme. Documentation how to set the counter up and running safely aviable in hexo-leancloud-counter-security.

Install hexo-leancloud-counter-security by run following command in site root dir:

$ npm install hexo-leancloud-counter-security --save

Edit site config file and add following content:

hexo/_config.yml
leancloud_counter_security:
enable_sync: true
app_id: <<your app id>>
app_key: <<your app key>>
username: <<your username>> # Will be asked while deploying if is left blank
password: <<your password>> # Recommmended to be left blank. Will be asked while deploying if is left blank

Edit theme config file and fill options under leancloud_visitors section.

next/_config.yml
# Show number of visitors to each article.
# You can visit https://leancloud.cn get AppID and AppKey.
leancloud_visitors:
enable: false
app_id: #<app_id>
app_key: #<app_key>
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
# If you don't care about security in lc counter and just want to use it directly
# (without hexo-leancloud-counter-security plugin), set the `security` to `false`.
security: true
betterPerformance: false