V
V
Vislipuzly2017-08-14 15:59:52
Google Analytics
Vislipuzly, 2017-08-14 15:59:52

How to install a counter on Wordpress?

Hello) On the Internet, everyone installs counters in themes or through plugins, but the question is, is it possible to install a counter so that it is not tied to a theme and without a plugin? Let's say I'm a girl and I want to change themes once a week and I don't want to move the code back and forth once a week. I don't want plugins either. Where to put the code once and for all?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Yanchevsky, 2017-08-14
@Vislipuzly

Hello.
Make your own plugin and insert the counter there. In order not to activate the plugin from the admin panel, you can create the /wp-content/mu-plugins/ folder and put the plugin file there. It will download automatically.

add_action('wp_head', 'my_counter', 99);
function my_counter() {
?>
    код счетчика
<?php
}

K
Kirill Naumov, 2017-08-15
@deKubiK

Well, once and for all it will be quite difficult, because the counter is written into which is part of the template. Therefore, either do it according to the principle as Denis suggested, or call the counter through the google tag manager after a certain number of seconds of loading the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question