E
E
Egor2016-09-02 06:38:18
JavaScript
Egor, 2016-09-02 06:38:18

How to view yaCounter property in window?

When loading the site in the chrome console, I type window and look at its properties. There is no yaCounterXXXX property there, but if you type window.yaCounterXXXX it shows the metric object normally. After if you look at window, then at the end there will already be yaCounterXXXX. The page seems to be fully loaded. Is it possible to immediately see yaCounterXXXX in window if window is immediately viewed after page loading?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Tsymbal, 2017-06-29
@AlexanderTsymbal

Accidentally came across your question in Google :)
Unsubscribe, suddenly interesting so far.
You can't get to the methods (or whatever they're called) of the window object until they're defined. The definition of yaCounter occurs after the watch.js script is loaded (it, in turn, is requested by the metric code placed on your pages). Those. this cannot be done immediately after loading the page code.
But you can wait for $(window).on("load") - this is with jQuery. And after the page is fully loaded try to access yaCounterXXXX in window.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question