A
A
AlexMark2016-09-29 22:04:10
Google
AlexMark, 2016-09-29 22:04:10

Did I understand the process of installing google analytics on the site correctly?

I'm just about to launch my first website (like a business card), where I will learn and test different features. Now I want to try to install Google analytics to monitor visitors.
As far as I understand, I need

<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-84967762-1', 'auto');
  ga('send', 'pageview');

</script>

paste this code into analyticstracking.php.
And add after the body tag to each file - <?php include_once("analyticstracking.php") ?>
but I have the body tag open. in the header, which is just a separate file, and others include it. That is, I only need to specify it there once and it will work all right?
And nothing else needs to be done ?, everything will work?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cube, 2016-09-29
@AlexMark

Insert in the header, which you have as a separate file.

S
shell1989, 2016-09-30
@shell1989

Insert in header

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question