Setting up google analytics

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

31 Replies - 710 Views - Last Post: 07 January 2017 - 06:02 AM

#16 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 05 January 2017 - 03:36 PM

Ok I made the following new page and called it analyticstracking.php

<!doctype html>
<html>
<head>
<script>
03
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
04
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
05
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
06
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
07
 
08
  ga('create', 'UA-89888824-1', 'auto');
09
  ga('send', 'pageview');
10
 
11
</script>


<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
</body>
</html>



And to make sure it was working. I did the following to my index.php page.


<?php include_once("analyticstracking.php")
  $pageTitle = "Home";
  include('inc/header.php');
  ?>

  <div class="container bg-color">
      <div class="row">
            <div  style="padding-top: 15px;">
                <div id="myCarousel" class="carousel slide" data-ride="carousel">
                    <!-- Indicators -->
                    <ol class="carousel-indicators">
                        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                        <li data-target="#myCarousel" data-slide-to="1"></li>
                        <li data-target="#myCarousel" data-slide-to="2"></li>
                        <li data-target="#myCarousel" data-slide-to="3"></li>
                        <li data-target="#myCarousel" data-slide-to="4"></li>
                    </ol>

                    <!-- Wrapper for slides -->
                     <div class="carousel-inner" role="listbox">
                        <div class="item active">
 <img src="img/AdobeStock_83234383.jpg" alt="" width="1920" height="546">
</div>
<div class="item">
 <img src="img/AdobeStock_110313737.jpg" alt="" width="1920" height="546">
</div>
<div class="item">
 <img src="img/AdobeStock_72595945.jpg" alt="" width="1920" height="546">
</div>
<div class="item">
 <img src="img/image5675.jpg" alt="" width="1920" height="546">
</div>
<div class="item">
 <img src="img/image6633.jpg" alt="" width="1920" height="546">
</div>
                    </div>

                    <!-- Left and right controls -->
                    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                        <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                        <span class="sr-only">Next</span></a>
              </div>  
        </div>
    </div>
</div>
        &nbsp;
        <div class="container bgWhite">
        <div id="title">
         <div class="left">Home</div>
         <div class="right"><a href="https://www.facebook.com/groups/637729496399795/" target="_blank"><img src="img/Facebook.jpg" width="50" height="50" alt="Facebook"/></a>&nbsp;&nbsp;<a href="https://twitter.com/EmpoweredGolf" target="_blank"><img src="img/twitter.jpg" alt="Twitter" width="50" height="50" border="0"/></a></div>
        </div>
 </div>
     
    
&nbsp;
        <div class="container bgWhite">
         <h2><u>Announcements</u></h2>
         
    
    </div>

&nbsp;
 <div class="container bgWhite">
 <h2>Mission</h2>
      <div class="big">At Empowered Golfers Manitoba, we promote the independence for people of all ages and abilities to experience the sport of golf. We provide a central location for our guests to explore a variety of resources including accessible golf products, accessible golf courses, and discussion boards to share questions and ideas. Whether it be individuals who are interested in trying golf for the very first time or individuals who would like to get back into golfing, despite challenges they may have in life, at Empowered Golfers Manitoba we strive to present our guests with valuable information to remove limitations to participating in golf.</div>
  &nbsp;     
  
</div>


    <?php include('inc/footer.php'); ?>

Was This Post Helpful? 0
  • +
  • -

#17 astonecipher  Icon User is offline

  • Licensed PITA
  • member icon

Reputation: 2204
  • View blog
  • Posts: 8,868
  • Joined: 03-December 12

Re: Setting up google analytics

Posted 05 January 2017 - 04:51 PM

What you did, is create a whole nother html page and are trying to drop it into another html page. Think this through a bit...



That isn't what you need to do.
Was This Post Helpful? 0
  • +
  • -

#18 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 05 January 2017 - 06:39 PM

Ok I took the code out of my index.php page. But I was told to make a separate page, like following and call it analyticstracking.php do you agree?

<!doctype html>
<html>
<head>
<script>
03
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
04
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
05
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
06
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
07
 
08
  ga('create', 'UA-89888824-1', 'auto');
09
  ga('send', 'pageview');
10
 
11
</script>


<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
</body>
</html>


But having say that. What I should of done is made it like the following?

<?php
<script>
03
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
04
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
05
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
06
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
07
 
08
  ga('create', 'UA-89888824-1', 'auto');
09
  ga('send', 'pageview');
10
 
11
</script>

?>
</html>

Was This Post Helpful? 0
  • +
  • -

#19 astonecipher  Icon User is offline

  • Licensed PITA
  • member icon

Reputation: 2204
  • View blog
  • Posts: 8,868
  • Joined: 03-December 12

Re: Setting up google analytics

Posted 05 January 2017 - 06:41 PM

That doesnt work either, but on a closer track atleast.
Was This Post Helpful? 0
  • +
  • -

#20 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 05 January 2017 - 06:54 PM

Well I see for starters one mistake I made and why my code was screwed up. What I will do is take the content from the analyticstracking.php and put it directly into my index.php page.

<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','https://www.google-analytics.com/analytics.js','ga');

 

  ga('create', 'UA-89888824-1', 'auto');

  ga('send', 'pageview');

 

</script>

Was This Post Helpful? 0
  • +
  • -

#21 ami.desai  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 05-January 17

Re: Setting up google analytics

Posted 06 January 2017 - 03:41 AM

Hi,
You can add GA script code to your footer page. so it will call on every request of your website.
Thanks
Was This Post Helpful? 0
  • +
  • -

#22 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 06 January 2017 - 09:28 AM

I tried the script in the header and the footer, and nothing.Right now I have it in the footer.php

<div class="container">
  <div class="row">
    <div class="col-sm-12 whiteText">
      <p>&copy; <?php echo date('Y'); ?> Empowered Golfers Manitoba</p>
    </div>
  </div>
</div>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled Javascript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<?php 
	if ($pageTitle == "Chatroom") 
	{
		echo '
		<script src="chatSocketAchex.js"></script>
		<script type="text/javascript">
           $("#Chatroom").ChatSocket();
        </script>
		';
	}
?>
<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','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-89888824-1', 'auto');

  ga('send', 'pageview');

</script>
</body>

</html>

Was This Post Helpful? 0
  • +
  • -

#23 andrewsw  Icon User is offline

  • don't rely on secrecy
  • member icon

Reputation: 6086
  • View blog
  • Posts: 24,170
  • Joined: 12-December 12

Re: Setting up google analytics

Posted 06 January 2017 - 09:32 AM

Are there errors in your browser's console?
If not, what confirms to you that it isn't working?
Was This Post Helpful? 0
  • +
  • -

#24 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 06 January 2017 - 09:35 AM

I viewed the site and then checked google. Then I had someone else look at the site and nothing registered. I must of done something right yesterday. because I know this morning it showed I was on. Very strange.
Was This Post Helpful? 0
  • +
  • -

#25 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 06 January 2017 - 09:55 AM

Ok what I did was make a page called analyticstracking.php and added the following script jut like google said to,
 <?php 

<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','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-89888824-1', 'auto');

  ga('send', 'pageview');

</script>

?>



Then to my footer.php I added <?php include_once("analyticstracking.php") ?>

<div class="container">
  <div class="row">
    <div class="col-sm-12 whiteText">
      <p>&copy; <?php echo date('Y'); ?> Empowered Golfers Manitoba</p>
    </div>
  </div>
</div>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled Javascript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<?php 
	if ($pageTitle == "Chatroom") 
	{
		echo '
		<script src="chatSocketAchex.js"></script>
		<script type="text/javascript">
           $("#Chatroom").ChatSocket();
        </script>
		';
	}
?>
<?php include_once("analyticstracking.php") ?> 
</body>

</html>

Was This Post Helpful? 0
  • +
  • -

#26 andrewsw  Icon User is offline

  • don't rely on secrecy
  • member icon

Reputation: 6086
  • View blog
  • Posts: 24,170
  • Joined: 12-December 12

Re: Setting up google analytics

Posted 06 January 2017 - 10:32 AM

So does that work? Are there errors in your browser's console? It is not very enthralling to keep asking for the same basic information again and again.
Was This Post Helpful? 0
  • +
  • -

#27 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 06 January 2017 - 10:50 AM

You referring to the browser console in google analytics?
Was This Post Helpful? 0
  • +
  • -

#28 astonecipher  Icon User is offline

  • Licensed PITA
  • member icon

Reputation: 2204
  • View blog
  • Posts: 8,868
  • Joined: 03-December 12

Re: Setting up google analytics

Posted 06 January 2017 - 10:55 AM

No, your browser tools, when you are on your site
Was This Post Helpful? 0
  • +
  • -

#29 Maxx5  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 145
  • Joined: 15-September 15

Re: Setting up google analytics

Posted 06 January 2017 - 11:15 AM

Everything seems normal.
Was This Post Helpful? 0
  • +
  • -

#30 andrewsw  Icon User is offline

  • don't rely on secrecy
  • member icon

Reputation: 6086
  • View blog
  • Posts: 24,170
  • Joined: 12-December 12

Re: Setting up google analytics

Posted 06 January 2017 - 01:45 PM

That's a little ambiguous. Did you locate the browser's console? And it doesn't contain any errors?

Moving to Web Development forum, this has nothing to do with HTML/CSS.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3