如何用CSS实现埋点统计用户行为,方法是什么
Admin 2022-07-12 群英技术资讯 644 次浏览
当一个网站或者 App 的规模达到一定程度,需要分析用户在 App 或者网站的相应操作,则需要埋点统计用户行为,这个不用多说,具体实现有 JS 脚本写好埋点事件并调接口,今天 get 到一种新的埋点统计方式保证耳目一新。下面代码简单示范一下。
//index.html <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <title>CSS埋点</title> <style> .background { background-size: 100% 100%; width: 100%; height: 100%; position: fixed; z-index: -100; } html { background-color: #fff; } .notice-content { border: 1px #ccc solid; padding: 19px; border-radius: 10px; width: 80%; margin-left: 10%; margin-top: 10%; } .check-content { padding: 0!important; width: 80%!important; margin-left: 25px; margin-top: 10px; } .confirm { float: left; position: relative!important; left: 6%; height: 32px!important; line-height: 32px!important; } .btn { border: 1px solid #ff6689; background-color: #ff6689; width: 60%; margin-left: 20%; margin-top: 36px; font-size: 16px; font-weight: bold; color: #FFFFFF; } .title { display: block; text-align: center; font-size: 20px; margin-bottom: 19px; } span { display: block; margin-bottom: 7px; } .mui-checkbox input[type=checkbox]:checked:before, .mui-radio input[type=radio]:checked:before { color: #ff6689; } .body-content { width: 100%; height: 100%; } body { background-color: rgba(239, 239, 244, 0)!important; } .link:active::after{ margin: 100px 100px; color: red; content: url("http://192.168.1.100:8888/Hotels_Server/view/count.php?action=visit"); } </style> </head> <body> <div class="loading"> </div> <div style="" class="body-content"> <div class="background"> <!-- <img id="background" src="img/background.png"> --> </div> <div class="notice-content"> <label class="title">登记须知</label> <span>1.本次登记仅限于中国地区。</span> <span>2.完成登记审核通过后,生育登记服务卡可到乡(镇、街道)直接领取,也可选择邮寄到付快递给申请人。</span> <span>3.申请登记信息需真实完整,如有虚假,申请人将承担相应的法律责任。</span> </div> <a class="link title">访问</a> </div> </body> </html>
//count.php <?php /** * Created by PhpStorm. * User: geek * Date: 2018/1/18 * Time: 上午9:56 */ $actionName = $_REQUEST["action"]; //时间格式化 $time = time(); $time = Date("Y-m-d",$time); echo "访问动作->" .$actionName. " 访问时间->" . $time; ?>
css点击统计
php代码统计
说明
当然这种方式使用比较简单的事件埋点。复杂的话还是需要 JS 操作。
JS 埋点统计用户可以通过浏览器禁用,CSS的话没办法禁用
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
css中,可以利用overflow属性来实现字体溢出隐藏效果。下面通过代码示例来介绍一下overflow属性如何实现字体溢出隐藏<!DOCTYPE html><html><head><meta charset="utf-8"><sty
这篇文章我们来了解CSS内嵌样式的相关内容,css内嵌样式是将css写在网页源文件的头部,利用style标签将css样式代码包围的样式。接下来我们详细的看看CSS内嵌样式有什么特点。
在网页设计中,常会遇到让元素在网页居中的需求,那么怎么把元素居中在网页?有什么方法?其实实现元素居中并不难,接下来我们就一起来了解一下。
html5 audio标签怎么用?html5 audio标签自动播放和使用教程,下面开始我们的文章介绍,主要介绍了html5 audio标签的使用,还有关于html5 audio标签自动播放和暂停的教程详解
在我们打开某个网页的时候,可能会看到有的页面中有颜色的渐变,感觉很好看,那么,这种渐变色是如何实现的呢?所谓渐变色其实就是颜色之间的过渡,而html5 Canvas渐变是一种用于填充或描边图形的颜色模式,所以,利用canvas如何实现颜色的渐变?本篇文章就来给大家介绍一下canvas渐变色的实现。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008