Recently, I moved the WordPress English site from the original subdirectory:
https://www.shuijingwanwq.com/en/
Migrated to a separate subdomain:
https://en.shuijingwanwq.com/
Search engine-related site maps, 301 jumps, Google Search Console and Baidu Search resource platforms have been adjusted, but access statistics still need to be checked separately.
After the actual processing this time, it was found that the adjustment ideas of Google Analytics 4 and Baidu statistics are not the same.:
- GA4 does not need to recreate attributes or data streams, but needs to adjust the default presentation dimension of the report;
- Baidu statistics does not need to re-add websites, but it is recommended to increase cross-domain monitoring;
- Both platforms should continue to use the original statistical code;
- The historical data before and after the migration will not be automatically merged, and it needs to be distinguished by the domain name or the full URL.
This article records the complete inspection and adjustment process.
1. Statistical structure after migration
Before the migration, both the Chinese and English stations were located in the same domain name:
中文站:
https://www.shuijingwanwq.com/
英文站:
https://www.shuijingwanwq.com/en/
After the migration, the website structure becomes:
中文站:
https://www.shuijingwanwq.com/
英文站:
https://en.shuijingwanwq.com/
This change seems to just change the /en/ path to the en subdomain, but for access statistics, the identification method of the page has changed.
For example, the English article before the migration may be:
https://www.shuijingwanwq.com/en/2026/07/05/18871/
After migration, it becomes:
https://en.shuijingwanwq.com/2026/07/05/18871/
If the statistical report only shows the page path, then the migrated Chinese and English articles may be displayed as both:
/2026/07/05/18871/
At this time, just looking at the path, it is impossible to determine whether the data belongs to www or en.
2. First check whether the two domain names are loaded with the same statistical code
Before adjusting the statistics background, you must first confirm whether the statistics codes actually loaded by the two domain names are the same.
I executed the following command in the local terminal:
for u in \
"https://www.shuijingwanwq.com/" \
"https://en.shuijingwanwq.com/"
do
echo
echo "========== $u =========="
curl -sL "$u" |
grep -Eo 'G-[A-Z0-9]+|googletagmanager\.com/gtag/js\?id=[^"&<]+|hm\.baidu\.com/hm\.js\?[a-f0-9]+' |
sort -u
done
The returned result is as follows:
========== https://www.shuijingwanwq.com/ ==========
G-89CMTD9395
googletagmanager.com/gtag/js?id=G-89CMTD9395
hm.baidu.com/hm.js?abd646c01c6bac23ff98b9f3b12c32f1
========== https://en.shuijingwanwq.com/ ==========
G-89CMTD9395
googletagmanager.com/gtag/js?id=G-89CMTD9395
hm.baidu.com/hm.js?abd646c01c6bac23ff98b9f3b12c32f1
Result description:
- Two domain names use the same GA4 measurement ID;
- The two domain names use the same Baidu statistics code;
- There is no missing statistical code after the migration of the English station;
- There is no need to recreate the statistics item.
![[Figure 1, the result of the terminal checking the statistical codes of www and en domain names]](https://media.shuijingwanwq.com/2026/07/1-40.png)
3. Does Google Analytics 4 need to recreate the data stream?
The answer is no need.
www.shuijingwanwq.com with en. shuijingwanwq. com all belong to the same root domain name:
shuijingwanwq.com
The two subdomains can continue to use the same GA4 measurement ID.
Therefore, this migration is not required:
- Create a new GA4 attribute;
- Create a new Web data stream;
- Change the measurement ID;
- Split the data of the English station into another set of statistics.
The website url filled in in the GA4 data stream is not a strict whitelist for data collection. As long as the page loads the same metric ID correctly, the data can continue to be sent to the current attribute.
4. Why is the original GA4 report inconvenient to view?
What I was mainly looking at was:
Report → Interactivity → Web Pages and screens
The default dimension is:
网页路径和屏幕类
This dimension only shows the path, not the domain name.
For example:
/
or:
/2026/07/11/19327/
Before the migration, the English page was prefixed with /en/ , so it could be recognized from the path.:
/en/2026/07/11/19327/
After the migration, the English station is located in a separate subdomain, and the /en/ in the path has disappeared.
so:
https://en.shuijingwanwq.com/2026/07/11/19327/
with:
https://en.shuijingwanwq.com/2026/07/11/19327/
It may appear as in the ”Webpage Path’ report:
/2026/07/11/19327/
If there is the same path under the two domain names, the data may also be aggregated into the same row.
![[Figure 2, GA4 web pages and screen reports only display the path of the web page by default]](https://media.shuijingwanwq.com/2026/07/2-39-1024x528.png)
5. Temporarily add the ”host name’ sub-dimension
In order to confirm whether the data of the English domain name is collected normally, you can first click the blue plus sign next to the main dimension in the “Web Page and Screen” report.:
网页路径和屏幕类 +
Then search and add:
主机名
After adding, the report will be displayed at the same time:
网页路径 主机名
/ www.shuijingwanwq.com
/ en.shuijingwanwq.com
/2026/07/11/19327/ en.shuijingwanwq.com
In this way, it is possible to directly determine whether a record belongs to a Chinese station or an English station.
![[Figure 3, Add a host name secondary dimension to the GA4 web page and screen report]](https://media.shuijingwanwq.com/2026/07/3-39-1024x528.png)
Then enter in the search box at the top of the form:
en.shuijingwanwq.com
At that time, the data of English subdomains could be filtered out normally.
The verification data after the migration includes:
浏览次数:170
活跃用户:91
每位活跃用户浏览量:1.87
平均互动时长:17 秒
事件数:471
The data curve mainly begins to appear after the migration of the English site is completed, which is basically the same as the actual migration time.
This shows that:
- GA4 has recognized English subdomains normally;
- There are no statistics missing from the English station;
- The same measurement ID can count two subdomains at the same time.

However, the ”host name’ as a secondary dimension is usually only temporarily viewed, and there is no guarantee that it will be automatically retained every time the report is opened.
Therefore, the default dimensions of the report need to be further modified.
6. Set ”Web page location’ as the default GA4 dimension
For the current multi-subdomain structure, the dimension that is more suitable than “Web page path” is:
网页位置
‘Webpage Location” will display the full URL, for example:
https://www.shuijingwanwq.com/
https://en.shuijingwanwq.com/2026/05/01/9763/
https://en.shuijingwanwq.com/2026/07/11/19327/
In this way, there is no need to add an additional “host name”, and you can directly determine which domain name the data belongs to from the URL.
7. Customize the ”Web page and Screen’ report
enter:
Report → Interactivity → Web Pages and screens
Click the pencil icon in the upper right corner of the page to enter “Custom Report”.
![[Figure 5, click the customize button in the upper right corner of the GA4 webpage and screen report]](https://media.shuijingwanwq.com/2026/07/5-32-1024x524.png)
Click on ‘Report Data” on the right:
尺寸
The main dimensions originally included in the current report include:
- Page title and screen type;
- Web page path and screen class;
- Page title and screen name;
- Content group.
click:
添加维度
Then search and add:
网页位置
![[Figure 6, add the location of the web page to the GA4 report dimension]](https://media.shuijingwanwq.com/2026/07/6-27-1024x526.png)
After adding, click the three dots on the right side of ”Page Location’ to set it to:
默认
Click on the lower right corner:
应用
Finally, click “Save” at the top of the page and select:
将更改保存到当前报告
Do not select ”Save as New Report“, otherwise the original ”Web and Screen’ report will not be directly replaced.
![[Figure 8, save the changes to the current web page and screen report]](https://media.shuijingwanwq.com/2026/07/8-16-1024x510.png)
After saving, the report name in the left menu becomes:
网页和屏幕:网页位置
The table displays the full URL by default.
![[Figure 9, the GA4 web page and screen report display the complete web page location by default]](https://media.shuijingwanwq.com/2026/07/9-12-1024x524.png)
8. GA4 historical data will not be automatically migrated
It should be noted that GA4 will not automatically modify the previously collected data because the website has made a 301 jump.
The data of the English station before the migration will still be retained as:
主机名:
www.shuijingwanwq.com
网页路径:
/en/...
The data of the English station after the migration will be recorded as:
主机名:
en.shuijingwanwq.com
网页路径:
/...
These two pieces of data belong to different time stages, and GA4 will not be automatically merged or rewritten.
Therefore, when analyzing long-term trends, it is necessary to clarify the migration date and understand the URL structure before and after the migration separately.
9. The ”Web page location’ dimension needs to pay attention to the query parameters
Although ”Web page location’ can directly display the full domain name, it may also contain URL query parameters.
For example:
https://www.shuijingwanwq.com/article/
with:
https://www.shuijingwanwq.com/article/?utm_source=test
It may be counted as two different records.
But for my current needs, the first thing to be solved is to distinguish:
www.shuijingwanwq.com
and:
en.shuijingwanwq.com
Therefore, setting ”Web page location’ as the default dimension is still the most intuitive solution.
10. Baidu statistics does not need to create a new English website
After the GA4 adjustment is completed, check Baidu statistics next.
The two domain names have been confirmed to load the same Baidu statistics code:
abd646c01c6bac23ff98b9f3b12c32f1
So no need:
- Create a new English station statistics project;
- Generate a new Baidu statistics code for English sites;
- Delete the original statistics site;
- Split the Chinese station and the English station into two sets of Baidu statistics.
The two domain names can continue to be classified into the same site statistics.
11. Add Baidu statistics cross-domain monitoring for English subdomains
After entering the Baidu statistics background, open:
Usage Settings → Rule Settings → Cross-domain monitoring
Fill in “Enter Domain Name’:
en.shuijingwanwq.com
No need to add when filling in:
https://
Don’t need the end either:
/
Then click:
添加
After the addition is successful, the list of “Website domain names that have been set up for cross-domain monitoring” will appear:
en.shuijingwanwq.com

Cross-domain monitoring is mainly used to help Baidu statistically identify users’ continuous visits between two domain names.
For example, a user clicks on the language switch from the Chinese site to enter the English site.:
www.shuijingwanwq.com
↓
en.shuijingwanwq.com
After configuring cross-domain monitoring, Baidu statistics will try to identify it as the same continuous visit, rather than completely splitting it into two unrelated access processes.
This setting mainly affects the data generated after the addition, and will not go back to recalculate the previous statistical results.
12. Distinguish Baidu statistics through ‘Surveyed domain names”
After adding cross-domain monitoring, go back to Baidu statistics:
Overview → Access Analysis → Surveyed Domain Names
Here you can directly view the data generated by the two domain names separately.
It was already displayed normally in the report at that time:
| domain name | Page views PV | Number of visitors UV | Number of IPS | Bounce rate | Average length of stay |
|---|---|---|---|---|---|
www.shuijingwanwq.com | 213 | 142 | 133 | 80.67% | 00:02:41 |
en.shuijingwanwq.com | 33 | 7 | 7 | 66.67% | 00:04:57 |
| Current summary | 246 | 149 | 140 | 79.63% | 00:02:59 |
![[Figure 11, Baidu statistics shows both www and en in the domain name report surveyed]](https://media.shuijingwanwq.com/2026/07/11-9-1024x434.png)
This shows that:
- Baidu statistics have been collected normally for English domain names;
wwwandencan be viewed separately;- There is no problem with two domain names being classified into the same set of statistical codes;
- With the addition of cross-domain monitoring, access identification between domain names will be more consistent.
13. The final result of this statistical adjustment
After the English site is migrated from /en/ to the en subdomain, the final configuration of Google Analytics and Baidu Statistics is as follows.
Google Analytics 4
Continue to use the original:
G-89CMTD9395
No new attributes are created, and no new data streams are created.
The default dimension of the ”Web page and Screen’ report is from:
网页路径和屏幕类
Adjusted to:
网页位置
You can directly view the full URL in the future to distinguish:
https://www.shuijingwanwq.com/...
with:
https://en.shuijingwanwq.com/...
Baidu Statistics
Continue to use the original statistical code:
abd646c01c6bac23ff98b9f3b12c32f1
in:
Usage Settings → Rule Settings → Cross-domain monitoring
Add in:
en.shuijingwanwq.com
Pass later:
Overview → Access Analysis → Surveyed Domain Names
Check the data of the Chinese station and the English station separately.
14. Summary
In this migration, there is no problem with the statistical code itself. What really needs to be adjusted is the way the background reports are viewed.
The original “Web page path” of GA4 is suitable for a single domain name or sub-directory structure, but after the English site is migrated to a separate subdomain, the same path may exist under www and en at the same time.
After changing the default dimension to “Web page location”, the complete domain name and page path will be displayed at the same time, making it more intuitive to view.
Baidu statistics continues to use the same set of codes, only need to increase cross-domain monitoring of English domain names, and view the two domain names separately through the “Surveyed domain Names” report.
In the end, this statistical adjustment has been completed:
GA4:
同一个属性
同一个数据流
同一个衡量 ID
默认显示完整网页位置
百度统计:
同一个统计站点
同一份统计代码
添加英文域名跨域监控
通过受访域名区分 www 与 en
For websites that migrate from the WordPress/en/ subdirectory to the English subdomain, this processing method can not only retain historical statistics, but also avoid data faults caused by re-splitting statistical items.
需要长期技术维护或远程问题排查?
我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。
如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:
- ✅ PHP / Laravel / Yii2 老项目无人维护
- ✅ Go / Gin 后端接口需要排查或优化
- ✅ WordPress 网站访问慢、报错或插件冲突
- ✅ Nginx / MySQL / Redis / Linux 服务器异常
- ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
- ✅ 需要长期远程技术支持或兼职维护
更多介绍请查看:关于我 & 合作
微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan

发表回复