Add code analytics to blog Wordpress

0

I'm trying to change the Analytics code of a blog in Wordpress. However, I do not have much knowledge and I'm having trouble figuring out how the code was added.

As I researched, I was able to figure out 3 ways to add analytics code to wordpress. However, none of these forms has been used and yet it has an added analytics code.

The forms I found are:

  • Using a plugin (I looked in the plugins and did not find Google Analytics or any other plugin with the word "Analytics" ).
  • Inserting the code into header.php of the theme (The theme does not have the analytcs tag script. But it has a PHP function that might add something: <?php wp_head(); ?> However, I'm not sure if the code is inserted by this function).
  • Creating a new function in the file functions.php (I looked for this file and it also has no script for analytics)

These were the only ways I found of adding Analytics code to Wordpress. But by the looks of it, the code has been added in another way.

Are there other ways to add Analytics code in Wordpress?

    
asked by anonymous 19.02.2018 / 17:09

2 answers

0

I finally figured it out. Thanks for your help. Thanks to everyone who tried to help with tips in the comments: D

Before I was always accessing Appearance - > Editor , selecting the current theme and looking for the code in the files header.php , functions.php and the others.

But this time I was in Aparência -> Temas . All topics have been listed. I clicked Personalize for the theme I'm using. A new editing screen loaded with a side menu. I clicked the Theme Panel option in the menu. After that another configuration page was opened "Newspaper - Theme panel" displaying the menu of the own wordpress panel and another menu of the theme to the side. Then I clicked on the ANALYTICS menu of the theme. And a box with the analytics code was opened! :)

Full path: Appearance - > Themes - > Customize - > Theme Panel - > ANALYTICS

    
28.02.2018 / 04:39
-3

Sign in to the header.php or footer.php of your TEMA and add the code Provided by Google.

Example of a Google code:

<!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-114669691-1"></script><script>window.dataLayer=window.dataLayer||[];functiongtag(){dataLayer.push(arguments);}gtag('js',newDate());gtag('config','UA-ID-1');</script>
Noheader.phpcoloqueantesde</head>Nofooter.phpcoloqueantesdo</body>

Example:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Exemplo</title>

    <!-- Faça dessa forma se for usar no header.php -->

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-114669691-1"></script><script>window.dataLayer=window.dataLayer||[];functiongtag(){dataLayer.push(arguments);}gtag('js',newDate());gtag('config','UA-ID-1');</script><!--Façadessaformaseforusarnoheader.php--></head><body><h1>OláMundo!</h1><!--Façadessaformaseforusarnofooter.php--><!--Globalsitetag(gtag.js)-GoogleAnalytics--><scriptasyncsrc="https://www.googletagmanager.com/gtag/js?id=UA-114669691-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'UA-ID-1');
    </script> <!-- Faça dessa forma se for usar no footer.php -->
  </body>
</html>
    
25.02.2018 / 23:07