How can I smoothly switch the 'Statistics Code Tag' in Anqi CMS to replace the existing statistical code?

Calendar 👁️ 70

As a website operator, we often need to adjust or replace the statistical code used on the website according to business development and data analysis needs.Whether it is to migrate from the old statistical platform to the new platform, or to introduce more refined data tracking, this process requires us to complete the switch efficiently and smoothly, to avoid any interference with the normal operation of the website.

The Anqi CMS fully considered these operational level flexibilities from the beginning, providing a very convenient "statistical code tag" feature, making it extremely simple and safe to replace existing statistical codes.Let's take a look at how to use this feature to implement a smooth switch in the statistical code.

Familiarize yourself with the 'Statistics Code Tag' of AnQi CMS

In AnQi CMS, there is no direct backend setting item called 'Statistics Code Tag', but this feature is cleverly integrated into the 'Link Push' module under 'Function Management', specifically reflected in the '360/Toutiao and other JS automatic submission' setting item.This name might lead people to believe that it can only be used for the statistics of 360 or Toutiao, but in fact, it is a universal JS code auto-submit box, which can be used for unified management for any statistics code based on JavaScript, such as Baidu Statistics, Google Analytics, Matomo, or any other JavaScript-based statistics code.

There will be a preset 'Statistics Code Tag' within the system (i.e.{{- pluginJsCode|safe }}),It will automatically insert any JS code you enter in this background setting box, securely and completely into the corresponding position of the website (usually on the<head>or<body>Tag inside), ensure that the code can be loaded and executed correctly.The benefit of this design is that you do not need to directly modify any template files, all code management is completed in the background, which greatly reduces the technical threshold and risk of errors in operation.

steps for a smooth transition of statistical code

When you need to replace the statistical code on the website, Anqi CMS provides the following simple and intuitive steps:

  1. Obtain the new statistical code:First, you need to go to the new statistics platform (such as Google Analytics 4, Baidu Statistics, etc.), find and copy the complete JavaScript statistics code provided. Make sure that the code you copy is complete, as it will usually include<script>and</script>.

  2. Log in to the Anqi CMS backend, locate the settings entry:Log in to your AnQi CMS admin interface. In the left navigation bar, find and click on "Function Management", then select the sub-menu "Link Push".

  3. Replace old code, paste new code:On the "Link Push" page, you will see a text box named "360/Toutiao and other JS automatic submission."}This text box should currently contain the statistical code your website is using. To smoothly switch, simply delete all the existing statistics code from this text box and then paste the new statistics code you copied in the first step.Please note that even if the new statistical code is just a line or a few lines, make sure it includes<script>and</script>.

  4. Save settings and update cache:After pasting the new code, be sure to click the "Save" or "Submit" button at the bottom of the page to make the changes effective.To ensure that the website front-end can immediately load the new statistical code, it is recommended that you click on the "Update Cache" function in the left navigation bar later and clear the website's cache.This can make the latest configuration take effect immediately.

  5. Verify that the statistical code is working:After completing the above steps, open your website's front-end page, and use the browser's developer tools (usually F12), to view the page source code or network requests.

    • View the source code:Search for the characteristics of the statistical code you have just pasted, to see if it has already appeared in the HTML of the page.
    • View network requests:In the network tab of the developer tools, filter the JS files, you can usually see the loading requests for statistics scripts (such asanalytics.js/gtag.jsorhm.jsetc).
    • Use the statistics platform to report in real time:Log in to the backend of the new statistics platform to view the real-time report function.If you can see that there are visitors browsing your website (which is yourself), then it means that the new statistics code has been successfully installed and is now working.

Why is this switching method smooth and efficient?

The 'Statistics Code Tag' feature of Anqi CMS can achieve smooth and efficient switching mainly due to its core advantages:

  • Do not touch the template file:You do not need to open an FTP client, nor do you need to face complex HTML/Twig template code; all operations are completed in the intuitive backend interface, greatly reducing the risk of误operation.
  • One-click full site update:Just replace the code once in the background and save, Anqi CMS can ensure that this new statistical code takes effect on all pages of your website without having to modify each page individually.
  • Centralized management, clear and concise:All statistical codes are managed in one place, so they can be quickly located when auditing, modifying, or removing, avoiding the situation where codes are scattered and difficult to maintain.
  • Rapidly respond to operational changes:Whether it is the change in data analysis requirements or the need to urgently deploy new tracking codes for market activities, this centralized management can allow you to respond quickly and ensure the continuity of data tracking.

In this way, even if you are not very familiar with programming and website development, you can easily manage and replace the statistical code of the website, making your content operation and data analysis work smoother.


Frequently Asked Questions (FAQ)

Q1: Can I use two different statistics codes (such as Baidu Statistics and Google Analytics) at the same time in the "JS Auto Submit" box?Of course you can. Just paste the two statistical codes one after another in the text box of '360/Toutiao and other JS automatic submission'.The 'Statistics Code Tag' of Anqi CMS will insert them into the website page in the order you paste.Make sure each statistics code block contains the complete<script>.

Q2: Can I use a specific tracking code only on certain pages instead of site-wide, can Anqi CMS achieve this?The 'Statistics Code Tag' of AnQi CMS is mainly used for the common statistics code throughout the site.If you have a page-level detailed statistical requirement, such as loading special code only on a specific event page, or excluding certain pages from loading general code, this usually requires a deeper template edit.You can make conditional judgments in the template file based on the current page ID, category ID, or other identifiers, and then manually insert or exclude specific code.Of course, this requires some knowledge of template development.

Q3: Why did I replace the statistical code and cleared the cache, but the front-end page still does not display the new code?There are several possible reasons:

  1. Browser Caching:Your browser may be caching an old version of the page. Try force refreshing the page (Ctrl+F5 or Cmd+Shift+R), or clear the browser cache and visit again.
  2. CDN cache:If your website uses a CDN service, the CDN nodes may cache old pages. You need to log in to the CDN service provider's backend and manually refresh the entire site cache.
  3. Code error: The statistics code you have pasted may contain syntax errors or be incomplete, causing it to fail to load. Please carefully check whether the code you copied from the statistics platform is complete and error-free.
  4. The background save did not take effect:Please confirm again that you have saved the changes in the Anqi CMS background, and the system prompts that the save was successful. Sometimes network issues can cause the save to fail.

Related articles

Can the Data Statistics feature be integrated with other internal systems?

In the daily operation of websites, data plays a crucial role.AnQiCMS (AnQiCMS) as an efficient and customizable enterprise-level content management system, its built-in data statistics function undoubtedly provides a convenient window for us to understand the operation status of the website.But when we think further, whether these valuable data can be integrated with other systems we already have in our enterprise, such as Customer Relationship Management (CRM), Enterprise Resource Planning (ERP) or Business Intelligence (BI) platforms to achieve a more comprehensive insight and decision support, this has become a core issue

2025-11-07

Can the 'Crawler Monitoring' identify malicious crawlers or crawler attacks?

Good, as an experienced website operator, I will talk to everyone about the AnQiCMS (AnQiCMS) crawler monitoring function, as well as its actual role in identifying malicious crawlers and responding to attacks. --- ### Can AnQi CMS identify malicious crawlers and attacks?In today's internet environment, website operators often face various challenges, among which the management of crawlers (also known as spiders) is undoubtedly an important aspect.We all know that the friendly crawler of a search engine is the key to a website getting traffic, but at the same time

2025-11-07

How to avoid inserting the same statistics code twice when using the 'Statistics Code Tag'?

The website is in operation, traffic statistics are an indispensable link to understand user behavior and evaluate the effectiveness of content.AnQiCMS (AnQiCMS) provides a convenient "Statistical Code Tag" feature, allowing us to easily deploy various third-party statistical codes to the website.However, if you are not careful with the method, it is easy to inadvertently insert the same statistical code repeatedly, which not only may lead to distortion of traffic data but also may slow down the page loading speed, affecting user experience.

2025-11-07

Does the 'Data Statistics' feature of AnQi CMS support custom event tracking?

In website operation, data statistics is an indispensable part of understanding user behavior and optimizing content strategy.It is particularly important for operators using AnQiCMS to understand the depth and breadth of its built-in data statistics function, especially the support for "custom event tracking". ### Overview of AnQi CMS built-in data statistics function AnQi CMS, designed specifically for small and medium-sized enterprises and content operation teams, provides basic and practical functions in data statistics.

2025-11-07

Does the 'Traffic Statistics and Spider Monitoring' feature consume a lot of server resources?

As website operators, we are always pursuing data growth while also being vigilant about any factors that may slow down the website speed.Especially when it comes to modules that need to collect and process a large amount of data in real time, such as traffic statistics and crawler monitoring, performance consumption is often our biggest concern.In the end, even if a feature is powerful, it is not worth it if it sacrifices the website's access speed.Then, will the built-in traffic statistics and crawler monitoring function of AnQiCMS (AnQiCMS) also cause the server to be overloaded and become a potential bottleneck for website performance?My opinion is, there is no need to worry too much

2025-11-07

Does AnQi CMS provide the ability to integrate statistical code required for A/B testing?

The AnQi CMS is an efficient and customizable content management system, playing an important role in website operations.When it comes to the statistical code integration capabilities required for A/B testing, although Anqin CMS itself does not directly provide an integrated A/B testing platform and traffic distribution logic, its design philosophy and rich features provide a solid foundation and high flexibility for integrating third-party A/B testing tools. Understanding this question requires looking at it from two levels: first, the embedding of statistical code, and secondly, the creation and management of page variants required for A/B testing.

2025-11-07

Does the statistics code tag support loading based on user role or login status?

In website operation, data statistics is the core to understand user behavior, optimize content strategy, and improve conversion rate.However, not all user data needs to be tracked in the same way, especially for internal team members, administrators, or specific VIP users, where we may want to avoid mixing their behavioral data into public-facing statistical reports or load statistical codes for specific user groups due to privacy considerations.For AnQi CMS users, a common and very practical question is: Can we flexibly decide whether to load the page statistics code based on user roles or login status?

2025-11-07

How to use AnQiCMS template tags correctly to avoid common errors?

AnQiCMS provides a powerful and flexible template system, allowing the display of website content to be highly customizable.The syntax of its template tag language draws inspiration from the Django template engine and integrates the ease of use of Blade templates, making it easy for users unfamiliar with the Go language to get started.However, to fully utilize the potential of template tags and avoid common mistakes, it is crucial to understand their correct usage and potential pitfalls.### AnQiCMS Template Tag Basics: Understanding Core Syntax and Conventions AnQiCMS template files are usually formatted with `

2025-11-07