Analytics
4.9K members online now
4.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Home Page not Tracking

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I am able to get all the analytics working on this website on all pages besides the home page. Disclaimer, I did not create this website so I'm coming in after the fact.  The page uses php so I created a template and put an include code on my index.php page but it is still not working. I have also tried embedding the script into the header. Can anyone help out?

 

<?php include_once("lib/config.php");?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="y_key" content="3cf695839f2d4c6c" />
<title>Park City Gun Club</title>
<meta name="description" content="Park City Gun Club provides an exciting, friendly gun shooting facility and training center with all of the latest technology" />
<meta name="keywords" content="Park City Gun Club, Utah Shooting Range, Gun Shooting Range Utah, Guns for sale, Shooting, Target, Simulation, Indoor Shooting, Ammunition, Gun Ammo" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/grid.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: "/images/gunshot.mp3"
});
},
swfPath: "/js",
supplied: "mp3"
});
});
</script>
<script type="text/javascript" src="js/ddsmoothmenu.js"></script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" media="screen" />

<script type="text/javascript">
$(document).ready(function() {

$("#directionShow").fancybox({
'titlePosition' : 'inside',
'transitionIn' : 'none',
'transitionOut' : 'none'
});
$("#charterShowbottom").fancybox({
'titlePosition' : 'inside',
'transitionIn' : 'none',
'transitionOut' : 'none'
});

});
</script>
<link rel="stylesheet" href="css/jquery.ui.all.css" />

<script language="javascript" type="text/javascript">
function emptyTextValue(id)

{

if(document.getElementById(id).value=="")

{

document.getElementById(id).value='Search';

}else if(document.getElementById(id).value=="Search")

{

document.getElementById(id).value='';

}

}
</script>
<script type="text/javascript">

ddsmoothmenu.init({
mainmenuid: "smoothmenu1", //menu DIV id
orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu', //class added to menu's outer DIV
//customtheme: ["#1c5a80", "#18374a"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>
<!--[if lt IE 7]>
<div style=' clear: both; text-align:center; position: relative;'> <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://www.theie6countdown.com/images/upgrade.jpg" border="0" alt="" /></a></div>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen">
<![endif]-->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-27398948-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>

<script language="javascript" type="text/javascript">
function playSound(elem, soundfile) {
//document.getElementById("sound").innerHTML += "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
$("#jquery_jplayer_1").jPlayer("play");
var url = elem.getAttribute("href");
var js = "window.location = '" + url + "';";
setTimeout(js, 750);
return false;
}
</script>

</head>

<body>

<?php include_once("analyticstracking.php") ?>

<div class="main bodysection">
<!--==============================header=================================-->

<div id="for_apple">
<?php include('includes/menu.php');?>
<?php include('includes/leftbar.php');?>

<article class="bodypart">

<video width="637" height="406" poster="videos/preview.jpg" controls autoplay onClick="window.location = '/content.php?page=memberships'">
<source src="videos/gunclub-video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="videos/gunclub-video.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="videos/gunclub-video.ogv" type='video/ogg; codecs="theora, vorbis"'>

<object id="flash_fallback_1" class="vjs-flash-fallback" width="637" height="481" type="application/x-shockwave-flash"
data="videos/videopage2.swf">
<param name="movie" value="videos/videopage2.swf" />
<param name="wmode" value="transparent" />
<param name="allowfullscreen" value="true" />
</object>
</video>

</article>
</div>
<div class="clear"></div>

<aside>
<?php include('includes/boxes.php');?>
</aside>
</div>

<?php include('includes/footer.php'); ?>
<script type="text/javascript">
//swfobject.registerObject("FlashID");
</script>

<div id="jquery_jplayer_1" class="jp-jplayer"></div>
</body>
</html>

 

Re: Home Page not Tracking

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

Maybe you have placed the file in wrong directory and script can't access it.

 

Remove this line:

<?php include_once("analyticstracking.php") ?>

 

and place Google Analytics tracking code directly in your index.php file right before closing </head> tag:

 

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXX-Y', 'auto');
ga('send', 'pageview');
</script>

</head>
<body>

Use your own tracking id instead of "UA-XXXXXX-Y".

 

 

 

Re: Home Page not Tracking

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Unfortunately, putting the code directly into index.php file does not work either. I put the code on individual pages through cpannel and that is working, but there is no option for the homepage on the cpannel menu. Could it be that cpannel is affecting the tracking?

Re: Home Page not Tracking

Participant ✭ ✭ ☆
# 4
Participant ✭ ✭ ☆
Could you share your website's URL?

Re: Home Page not Tracking

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Re: Home Page not Tracking

Participant ✭ ✭ ☆
# 6
Participant ✭ ✭ ☆
Google Tag Assistant is showing that your tracking working fine.
And I can see Analytics Tracking code in website source code.
The code that you have is a Classic version, but it's working and you should see traffic to your homepage.

When you open your homepage is there any traffic in real-time report in Google Analytics?

Re: Home Page not Tracking

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
I have experience implementing tag on this kind of websites, and micro-managing them can be really messy, as a off-topic recommendation, i really think that you should start using Google tag manager, because that way yo just have to implement one tag in every page of the site, and then you can administrate every and each tag from the Tag Manager web platform.
Here I leave to you the url for the free Google course: https://analyticsacademy.withgoogle.com/course05
And the web page of GTM: https://www.google.com/analytics/tag-manager/

Google Tag Manager made easy a lot of messy work that i had to do before, having to access a lot of FTPs, Cpannels, etc. For each web page, but with this platform you can do all this in one place. Also, many employers look for that in the CV.

Re: Home Page not Tracking

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
Nope, real time traffic is not showing up on the home page. The homepage isn't even on the all pages section of reporting. Everything other page is reporting perfectly though, so I am pretty confused.

Re: Home Page not Tracking

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
I'll give it a try.