Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yandex Metrica counter snippet #4895

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

azlydnev
Copy link

Add support for Yandex Merica counter.

Used standard snippet

https://metrika.yandex.ru/

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #4895 (444e439) into main (d2a58c8) will decrease coverage by 0.02%.
Report is 29 commits behind head on main.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               main    #4895      +/-   ##
============================================
- Coverage     32.08%   32.07%   -0.02%     
- Complexity    11386    11395       +9     
============================================
  Files          1170     1171       +1     
  Lines         47954    47974      +20     
============================================
  Hits          15388    15388              
- Misses        32566    32586      +20     
Files Coverage Δ
app/Services/ModuleService.php 50.99% <ø> (ø)
app/Module/YandexMetrica.php 0.00% <0.00%> (ø)

k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

ym(<?= json_encode((int) ($YANDEX_METRICA_ID ?? ''), JSON_THROW_ON_ERROR) ?> , "init", {
Copy link
Owner

@fisharebest fisharebest Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are casting this value to an int, then we do not need json_encode()?

Also, $YANDEX_METRICA_ID can never be null. So we do not need ?? ''


<div class="row mb-3">
<label for="YANDEX_METRICA_ID" class="col-sm-3 col-form-label">
<?= /* I18N: A configuration setting */ I18N::translate('Yandex Metica') ?>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Metica -> Metrica

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants