Under the background of globalization, enabling multilingual functionality on a website has become an important step for enterprises to expand into the international market.For operators, how to accurately grasp user behavior data of different language versions of websites and further optimize content and marketing strategies is a very practical and crucial issue.When the multi-language feature is enabled in AnQiCMS, can the statistical code distinguish and count for different language versions?The answer is affirmative, and the AnQi CMS provides a flexible implementation foundation.

Basic multi-language support of Anqi CMS

The AanQi CMS has considered multilingual needs from the beginning.The core function explicitly points out 'Multi-language support', which can realize the switching and display of multi-language content, providing a solid foundation for the global promotion of the enterprise.In the background "System Settings

When a website is configured in a multilingual mode, it usually uses different URL structures (for example:)yourdomain.com/en/to indicate the English version,yourdomain.com/zh/or to indicate the Chinese version), or through domain names (for example:)en.yourdomain.com,zh.yourdomain.com)to distinguish between different language versions.The AnQi CMS combines its powerful pseudo-static rule management and multi-site management features, which can flexibly support these multi-language URL strategies. This is the key premise for realizing refined statistics.

English code statistics distinguish the implementation principle

Although Anqi CMS provides traffic statistics and crawler monitoring functions, these built-in statistics usually provide an overview of the entire site, which is not sufficient to meet the needs of in-depth analysis of different language versions.To achieve accurate distinction and statistics of different language versions, it usually requires the assistance of third-party professional statistical tools, such as Google Analytics (GA), Baidu Statistics, etc.

  1. Distinguishing based on URL path or subdomain:This is the most common and recommended way. If different language versions correspond to different URL paths (such as/en/)or subdomain(such asen.yourdomain.com),access statistics tools can naturally classify the visit data of these pages under the corresponding language versions.
  2. Distinguish through custom dimensions/variables:Even if all languages are under the same domain, language switching through URL parameters or Cookie can also send the language information of the current page as data to the statistics server by using the Custom Dimensions feature provided by the statistics tool.
  3. Using different Tracking IDsConfigure an independent statistical tracking ID for each language version and completely separate the data.This method is more cumbersome to manage and is not conducive to cross-language data analysis, usually not recommended for different language versions of the same website unless business requirements call for complete independence.

Deploying statistics code in Anqi CMS and implementing differentiation

The template system and tag function of Anqi CMS provides convenience for deploying and distinguishing statistical codes.

Firstly, the statistical code of a website is usually placed in the website'sheadtags orbodyBefore the end tag. Safe CMS provides a convenient way to insert these global codes. For example, in the template file,{{- pluginJsCode|safe }}Label to output the background configuration statistics code, or directly inpartial/header.htmlorpartial/footer.htmlAdd code to this kind of public template.

To implement language differentiation, the key is to obtain the language information of the current page and adjust the logic of the statistical code accordingly. The Anqi CMS'ssystemtags can obtain the language information of the current site:

<script>
var currentLang = "{% system with name='Language' %}"; // 获取当前网站的语言设置,例如 "zh-cn" 或 "en-us"

// 假设您使用的是 Google Analytics 4 (GA4)
// 可以根据语言设置不同的衡量ID,或者发送语言作为自定义参数
if (currentLang === 'en-us') {
    // 针对英文站点的GA4衡量ID,或者发送英文相关的自定义事件
    // gtag('config', 'G-XXXXXXXXX_EN', {'language': 'en'});
    // gtag('event', 'page_view', {'language_version': 'english'});
} else if (currentLang === 'zh-cn') {
    // 针对中文站点的GA4衡量ID,或者发送中文相关的自定义事件
    // gtag('config', 'G-XXXXXXXXX_ZH', {'language': 'zh-Hans'});
    // gtag('event', 'page_view', {'language_version': 'chinese'});
} else {
    // 默认或其他语言站点的统计代码
    // gtag('config', 'G-XXXXXXXXX_DEFAULT', {'language': currentLang});
    // gtag('event', 'page_view', {'language_version': currentLang});
}

// 另一种常见做法是将语言作为自定义维度或用户属性发送
// 这需要在GA后台预先配置好自定义维度或用户属性
// gtag('set', 'user_properties', {'website_language': currentLang});
// gtag('event', 'page_view', {'custom_dimension_language': currentLang});

// ... 其他统计代码,如百度统计等,也可以根据 currentLang 进行条件判断 ...
</script>

In the above code snippet, by{% system with name='Language' %}Obtain the current language code, then use JavaScript conditional statements to dynamically load different statistical configurations, such as using different GA measurement IDs, or sending custom events and user properties with language identifiers to the statistical tool.Thus, in the reports of the statistical tools, the operators can clearly see the traffic, user behavior, conversion rate, and other data of websites in different language versions.

Data analysis and operation strategy

Through this differentiated statistics, operators can gain more detailed data insights:

  • Understand the performance of different language markets:What language versions attract more users? What are the differences in user stay time and bounce rate?
  • Optimize localized content:Adjust the attractiveness, keyword strategy, and user experience of content based on language versions.
  • Evaluate the effectiveness of multilingual marketing campaigns:For ad placement or promotional activities targeted at specific language regions, it can accurately evaluate the traffic and conversion it brings.
  • Conduct A/B testing:For different language user groups, test different page designs or copywriting to improve user satisfaction and conversion rates.

Summary

The AutoCMS provides a good technical foundation and flexible implementation for fine-grained statistics of multilingual websites.By utilizing its multilingual support, template tags, and pseudo-static management, combined with third-party statistical tools, operators have the full capability to accurately track and analyze data for different language versions of websites, thereby providing strong data support for global operation strategies.


Common Questions (FAQ)

1. Can the "Traffic Statistics and Spider Monitoring" feature built-in to AnQi CMS directly distinguish between different language versions of data?The traffic statistics feature built into AnQi CMS mainly provides an overview of the entire site, such as total visits, crawler access records, etc., and usually does not have the ability to differentiate in detail by language version.To achieve this goal, it is recommended that you combine with external professional statistical tools (such as Google Analytics, Baidu Statistics, etc.) and configure them according to the methods mentioned in the above article.

2. If my multilingual website uses different domains (for exampleen.example.comandzh.example.com) rather than subdirectories, what would be the different ways to deploy the statistics code?If the domain name is different, the deployment method will be slightly different.The simplest method is to configure independent statistics codes and measurement IDs for each domain (i.e., each language version).Thus, the statistics for each language version will be completely independent.If you need to perform cross-domain tracking, you will need to configure the corresponding cross-domain tracking settings in the statistics tool and include these configurations in the statistics code for each domain.The multi-site management feature of Anqi CMS can well support configuring different sites for each domain, thereby conveniently inserting the corresponding statistics code.

3. Besides statistics code, what other methods can help me understand the behavior and preferences of website users in different languages?In addition to traditional statistical codes, there are also many methods to understand multilingual users