公共模板与单页应用安装

本文说明模板站、CMS 和单页应用中部署统计代码的推荐方式。

适用场景

适用于多页面共用模板、前端框架路由切换或需要全站统一安装代码的项目。

操作步骤

  1. 找到全站公共入口,例如 header、layout、HTML 模板或 App 根组件。
    公共模板与单页应用安装 公共模板与单页应用安装
    界面示意,以实际后台显示为准。
  2. 将统计代码放在推荐位置,并确保全站页面都能加载到它。
  3. 单页应用需要确认路由切换后脚本仍然存在,必要时补充页面访问上报逻辑。
  4. 发布后使用检测工具检查真实页面,再到概览页确认数据。
    公共模板与单页应用安装 公共模板与单页应用安装
    界面示意,以实际后台显示为准。

注意事项

  • 不要同时在模板和业务页面重复粘贴统计代码。
  • 多域名项目应确认每个实际访问域名是否都属于当前站点配置。

本文說明範本站、CMS 和单页應用中部署統計程式碼的推荐方式。

適用場景

適用於多頁面共用範本、前端框架路由切换或需要全站统一安装程式碼的项目。

操作步驟

  1. 找到全站公共入口,例如 header、layout、HTML 範本或 App 根组件。
    公共模板與單頁應用安裝 公共模板與單頁應用安裝
    界面示意,以實際後台顯示為準。
  2. 将統計程式碼放在推荐位置,并确保全站頁面都能加载到它。
  3. 单页應用需要確認路由切换后脚本仍然存在,必要时补充頁面訪問上报逻辑。
  4. 發布后使用檢測工具检查真实頁面,再到概览页確認數據。
    公共模板與單頁應用安裝 公共模板與單頁應用安裝
    界面示意,以實際後台顯示為準。

注意事項

  • 不要同时在範本和業務頁面重复粘贴統計程式碼。
  • 多域名项目应確認每个实际訪問域名是否都属于當前站點配置。

This article explains recommended tracking-code deployment for template sites, CMSs and single-page applications.

When to use

Use it for shared templates, frontend route changes or projects that need one stable site-wide installation.

Steps

  1. Find the shared site entry, such as header, layout, HTML template or root App component.
    Template and SPA installation Template and SPA installation
    Interface example. Actual console display may vary.
  2. Place the tracking code in the recommended location and ensure all pages can load it.
  3. For SPAs, confirm the script remains available after route changes and add page-view reporting if needed.
  4. After publishing, check a real page and then confirm data in Overview.
    Template and SPA installation Template and SPA installation
    Interface example. Actual console display may vary.

Notes

  • Do not paste the tracking code into both shared templates and business pages.
  • For multi-domain projects, confirm that every visited domain belongs to the current site configuration.
文档导航
按问题类型归类,点击任意文档标题即可打开详情页。