我已经把6个网站全部都移动到同一台VPS上, 这样为了更好的管理 GOOGLE ANA帐号 可以在所有网站目录都可以访问得到的一个公共目录下 如: /home/googleana.php
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 | $google_ana['steakovercooked.com'] = 'UA-XXXX'; $google_ana['rot47.net'] = 'UA-XXXX'; $google_ana['helloacm.com'] = 'UA-XXXX1'; $google_ana['codingforspeed.com'] = 'UA-XXXX'; $google_ana['uploadbeta.com'] = 'UA-XXXX'; $google_ana['justyy.com'] = 'UA-XXXX'; $current_domain = strtolower($_SERVER['HTTP_HOST']); $google_ana_id = $google_ana[$current_domain]; function insert_google_ana() { global $google_ana_id; echo " <script language='Javascript'>\n var _gaq = _gaq || []; _gaq.push(['_setAccount', '$google_ana_id']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> "; } |
$google_ana['steakovercooked.com'] = 'UA-XXXX'; $google_ana['rot47.net'] = 'UA-XXXX'; $google_ana['helloacm.com'] = 'UA-XXXX1'; $google_ana['codingforspeed.com'] = 'UA-XXXX'; $google_ana['uploadbeta.com'] = 'UA-XXXX'; $google_ana['justyy.com'] = 'UA-XXXX'; $current_domain = strtolower($_SERVER['HTTP_HOST']); $google_ana_id = $google_ana[$current_domain]; function insert_google_ana() { global $google_ana_id; echo " <script language='Javascript'>\n var _gaq = _gaq || []; _gaq.push(['_setAccount', '$google_ana_id']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> "; }
存上不同网站的 帐号 这样只需要用的时候只需要 调用:
1 2 3 4 | <?php require_once("/home/googleana.php"); insert_google_ana(); ?> |
<?php require_once("/home/googleana.php"); insert_google_ana(); ?>
即可. 这样的好处是在同一个地方就可以管理所有的帐号 当然同样的 稍做修改 就可以应用到 google adsense 或者其它类型的代码上.
英文: https://helloacm.com/manage-google-analytics-account-in-one-place/
强烈推荐
- 英国代购-畅购英伦
- TopCashBack 返现 (英国购物必备, 积少成多, 我2年来一共得了3000多英镑)
- Quidco 返现 (也是很不错的英国返现网站, 返现率高)
- 注册就送10美元, 免费使用2个月的 DigitalOcean 云主机(性价比超高, 每月只需5美元)
- 注册就送10美元, 免费使用4个月的 Vultr 云主机(性价比超高, 每月只需2.5美元)
- 注册就送10美元, 免费使用2个月的 阿里 云主机(性价比超高, 每月只需4.5美元)
- 注册就送20美元, 免费使用4个月的 Linode 云主机(性价比超高, 每月只需5美元) (折扣码: PodCastInit2022)
- PlusNet 英国光纤(超快, 超划算! 用户名 doctorlai)
- 刷了美国运通信用卡一年得到的积分 换了 485英镑
- 注册就送50英镑 – 英国最便宜最划算的电气提供商
- 能把比特币莱特币变现的银行卡! 不需要手续费就可以把虚拟货币法币兑换
微信公众号: 小赖子的英国生活和资讯 JustYYUK