Update template for yandex counter#243
Open
axsapronov wants to merge 1 commit into
Open
Conversation
bittner
requested changes
Oct 8, 2025
| d.addEventListener("DOMContentLoaded", f, false); | ||
| } else { f(); } | ||
| })(document, window, "yandex_metrika_callbacks"); | ||
| <script type="text/javascript"> |
Member
There was a problem hiding this comment.
type="text/javascript" is unnecessary.
Suggested change
| <script type="text/javascript"> | |
| <script> |
| <script type="text/javascript"> | ||
| (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; | ||
| m[i].l=1*new Date(); | ||
| for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }} |
Member
There was a problem hiding this comment.
I assume this is code from the Yandex documentation. Can you paste its source in the PR description, please?
This loop may be written using forEach instead to avoid index errors.
| (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); | ||
|
|
||
| ym(%(counter_id)s, "init", %(options)s); | ||
|
|
Member
There was a problem hiding this comment.
This empty line is likely not needed.
| ym(%(counter_id)s, "init", %(options)s); | ||
|
|
||
| </script> | ||
| <noscript><div><img src="https://mc.yandex.ru/watch/%(counter_id)s" style="position:absolute; left:-9999px;" alt="" /></div></noscript> |
Member
There was a problem hiding this comment.
I know this is not part of your PR, but would be nice to be brought up-to-date with standards (HTML5).
Suggested change
| <noscript><div><img src="https://mc.yandex.ru/watch/%(counter_id)s" style="position:absolute; left:-9999px;" alt="" /></div></noscript> | |
| <noscript><div><img src="https://mc.yandex.ru/watch/%(counter_id)s" style="position:absolute; left:-9999px;" alt=""></div></noscript> |
bittner
reviewed
Oct 14, 2025
| @@ -12,25 +12,15 @@ | |||
|
|
|||
| COUNTER_ID_RE = re.compile(r'^\d{8}$') | |||
Member
There was a problem hiding this comment.
Another user reported in #244 that the counter id can now be longer that 8 characters. Can you also adjust this regular expression accordingly?
Suggested change
| COUNTER_ID_RE = re.compile(r'^\d{8}$') | |
| COUNTER_ID_RE = re.compile(r'^\d{8,10}$') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi folks.
JS Code for Yandex Metrica was changed. This PR will change template.
(recreated PR #235 )