以下脚本位于我网站的标题中。我想使用谷歌分析来监控指定网站发送到我要去的网站的流量。该脚本会将用户从我的网站重定向到我正在吸引流量的网站。我测试了脚本,它没有重定向。我在另一个网站上放置了指向我网站的链接,我必须测试脚本,但我没有被重定向到我试图吸引流量的网站。有任何想法吗?
<?php
$ref = $_SERVER["HTTP_REFERER"];
if ( $ref != 'http://www.websitetrafficiscomingfrom.com' )
exit;
?>
<?php if ( $ref == 'http://www.websitetrafficiscomingfrom.com' ) { ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-32605120-1']);
_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>
<!-- <?php } else if ($_SERVER['HTTP_REFERER'] != "") { ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-32554427-2']);
_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> -->
<meta http-equiv='REFRESH" content='0;url=websitetrafficissupposedtogoto.com'>
<?php } ?>