Setting up google analytics

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

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

#1 Maxx5  Icon User is offline

  • D.I.C Head

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

Setting up google analytics

Posted 05 January 2017 - 10:05 AM

I'm in the middle of setting up Setting up google analytics.I'm trying to follow these instructions.

Copy the Javascript tracking code snippet and add it to a file named analyticstracking.php. Then include the analyticstracking.php file on each PHP template page. For each template page, immediately after the opening <body> tag, add the following code:
<?php include_once("analyticstracking.php") ?>


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

<?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>
 
  ?>


What do they mean by, Then include the analyticstracking.php file on each PHP template page.

Is This A Good Question/Topic? 0
  • +

Replies To: Setting up google analytics

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 10:07 AM

If you have dynamically created pages (think CMS like Wordpress) then you need that line in the template pages. If you don't have those then follow the instructions for static pages.

https://support.goog...r/1008080?hl=en
Was This Post Helpful? 0
  • +
  • -

#3 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 - 10:09 AM

Ok. All my pages are PHP. so when they say template page. There really meaning, my pages? Thats where I'm confused. :)
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 10:11 AM

Do you programmatically make content for a page with your php?
Was This Post Helpful? 0
  • +
  • -

#5 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 - 10:13 AM

Sorry. I'm not sure what you mean. He is one of my pages.

<?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
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 10:16 AM

For a given page does the content/data/information being displayed change programmatically from information from a database?
Was This Post Helpful? 0
  • +
  • -

#7 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 - 10:17 AM

I think so.

http://www.empowered...ersmanitoba.ca/
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 10:19 AM

Dude.. really???

Static = does not change. Dynamic = shit changes.

A page that pulls data and programmatically changes a page's content is dynamic. Since a single dynamic page shows different data based on databases, other sources, etc.. that is called a 'template'.
Was This Post Helpful? 0
  • +
  • -

#9 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 - 10:20 AM

So I will add the following to each of my pages?

<?php include_once("analyticstracking.php") ?>
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 10:23 AM

*face palm*

Follow the instructions.
Was This Post Helpful? 2
  • +
  • -

#11 andrewsw  Icon User is online

  • don't rely on secrecy
  • member icon

Reputation: 6091
  • View blog
  • Posts: 24,183
  • Joined: 12-December 12

Re: Setting up google analytics

Posted 05 January 2017 - 10:29 AM

include('inc/header.php'); If this page has the opening body tag then you could include analyticstracking.php within this page, or just add its content.
Was This Post Helpful? 0
  • +
  • -

#12 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:16 PM

I'm still not getting it. It's all screwed up now.
Was This Post Helpful? 0
  • +
  • -

#13 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 03:20 PM

What is screwed up? You put that call to their php file in your header of your pages you want to track.
Was This Post Helpful? 0
  • +
  • -

#14 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:24 PM

I put <?php include_once("analyticstracking.php") ?> in my header and I got code errors.
Was This Post Helpful? 0
  • +
  • -

#15 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 12582
  • View blog
  • Posts: 49,551
  • Joined: 12-June 08

Re: Setting up google analytics

Posted 05 January 2017 - 03:27 PM

Come on man.. 129 posts and been here for sometime. Copy-paste the errors here. Remember - we are not there looking over your shoulder so being as verbose about what is happening, what should be happening, posting error messages, and posting relevant code all better help others to help you.
Was This Post Helpful? 0
  • +
  • -

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