Answer the question
In order to leave comments, you need to log in
How to add php code to modx?
Good afternoon, I'm trying to optimize a site on modx under Lighthouse, and everything rests on the fact that Yandex metrics and Google analytics scripts are loaded for a very long time.
I tried to put this code into a snippet and display it on the page, but this did not give any effect.
<?php if (!isset($_SERVER['HTTP_USER_AGENT']) || stripos($_SERVER['HTTP_USER_AGENT'], 'Lighthouse') === false): ?>
//Здесь код счётчиков метрики и аналитики
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question