首页 > 其他分享 >百度:为vue站添加百度统计

百度:为vue站添加百度统计

时间:2023-08-28 15:33:08浏览次数:35  
标签:vue 添加 script meta https hm com 百度

一,登录百度统计获取统计代码:

使用设置->网站列表->新增网站:

填写数据后点确定:

配置单页:

复制代码:

二,添加代码到vue的html页面

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 <!DOCTYPE html> <html lang="en">     <head>         <meta charset="utf-8" />         <meta http-equiv="X-UA-Compatible" content="IE=edge" />         <meta name="viewport" content="width=device-width,initial-scale=1.0" />         <meta name="keywords" content="" />         <meta name="description" content="" />         <link rel="icon" href="<%= BASE_URL %>favicon.ico" />         <title><%= htmlWebpackPlugin.options.title %></title>                   <% if (process.env.NODE_ENV === 'production' ) { %>         <script>             var _hmt = _hmt || [];         </script>         <% } %>     </head>     <body>         <noscript>             <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>         </noscript>         <div id="app"></div>         <!-- built files will be auto injected -->                         <% if (process.env.NODE_ENV === 'production' ) { %>         <script>             var _hmt = _hmt || [];             (function() {               var hm = document.createElement("script");               hm.src = "https://hm.baidu.com/hm.js?xxxxxxxxxxxxxxxxxxx";               var s = document.getElementsByTagName("script")[0];               s.parentNode.insertBefore(hm, s);             })();         </script>         <% } %>     </body> </html>

然后打包上传到服务器

liuhongdi@lhdpc:/data/vue/touch$ npm run build

说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/08/28/bai-du-wei-vue-zhan-tian-jia-bai-du-tong-ji/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: [email protected]

三,测试效果:

可以看到代码安装正确无问题

 

标签:vue,添加,script,meta,https,hm,com,百度
From: https://www.cnblogs.com/architectforest/p/17662403.html

相关文章

  • Vue【原创】日历组件
    最近项目中封装了一个日历组件,用于节假日管理,支持输入默认选中的日期,选择管理日期。效果图: calendar组件:1<template>2<divclass="calendar">3<slotname="title">4<divclass="calendar-title">{{curYearMont......
  • 为WPF按钮添加UAC盾牌图标
    在上一篇文章中,介绍了如何获取系统Shell的图标。在C#中调用SHGetStockIconInfo即可获取获取图标 定义SHGetStockIconInfo函数用到的数据结构1publicenumSHSTOCKICONID:uint2{3///<summary>Documentofatypewithnoassociatedapplicatio......
  • Vue3 使用Vuex与Vuex-persistedstate
    Vuex与vuex-persistedstateVuex是什么?Vuex是一个用于Vue.js应用程序的状态管理模式。它使得在应用程序中的所有组件之间共享和访问状态变得非常简单。Vuex将应用程序的状态存储在一个单一的存储库中,并且提供了一组用于更改状态的API。这使得状态管理变得更加可预测和易于调试。......
  • vue element 多个Form 表单同时验证
     多个Form内容统一提交验证1<el-formref="form1"></el-form>2<el-formref="form2"></el-form>3<el-formref="form3"></el-form>4<el-formref="form4"></el-form>......
  • vue3同一页面内重复引用同一操作dom的组件产生的问题
    [2023年8月28日12:39:40]vue3同一页面内标签<component>重复引用同一组件,且该组件内使用css选择器进行dom操作导致页面内相同组件发生变化的问题解决记录组件内进行dom操作,需要通过js方法进行选择器的元素获取,但当vue3全部渲染完毕后,页面内有多个id为test9的相同元素,元素选择将......
  • 如何在github或gitlab中将upstream项目中的新分支添加到fork后的origin项目中?
    1、问题:在gitlab或github中,将某项目进行了fork,fork后在自己的项目空间中就有了自己的origin项目,之后如果在源项目(upstream项目)中添加了新的分支,但是在自己的origin项目中不会被同步添加上,这就需要自己去添加这个分支(假如分支名为:new)。2、解决:要将新的分支添加到自己的origin项......
  • 百度WebUploader实现大文件上传下载
    ​ 文件夹数据库处理逻辑public class DbFolder{    JSONObjectroot;       public DbFolder()    {        this.root= new JSONObject();        this.root.put("f_id", "");        this.root.put("f_nameLoc", "......
  • normalizeKey is not a function #element #vue #疑难杂症
    normalizeKeyisnotafunction#element#vue#疑难杂症原因是组件中使用了import{Search}from'@element-plus/icons-vue'解决方案是,在main.ts中,将Vue的引入置顶。 //TOP import{createApp}from'vue' importAppfrom'./App.vue&......
  • Vue element 表单验证不通过时,滚动到校验未通过位置
    我们在使用elementIUI实现表单验证,内容比较多的时候,提示内容会被遮挡,这时候用户不清楚什么情况,还会连续点击提交按钮。这个时候需求来啦:我们需要在表单验证不通过的时候,页面滚动到对应校验不通过的位置。大致思路在表单验证方法validate中,提供了两个参数:是否校验成功,和未通过校......
  • vue使用swiper调到指定页(非initialSlide)
    使用swiper的Methods方法watch:{showIndx(n){this.$nextTick(function(){this.$refs.mySwiper.swiper.slideTo(n,1000,true)})},}完整模板代码<template><swiper:options='swiperOption'ref="mySwiper"cl......