U
U
Untit1ed2015-03-30 21:54:49
JavaScript
Untit1ed, 2015-03-30 21:54:49

What are the main advantages of inline instead of external JavaScript for analytics codes?

Many large sites place analytics codes directly on the page before the closing body tag. The question arose - how is such, at first glance, a lazy way better than the logic of analytics in an external script?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Martyanov, 2015-03-30
@vilgeforce

It is impossible to block the loading of scripts, for example. You can only disable it on the site itself.

E
evnuh, 2015-03-31
@evnuh

Not all browsers understand async/defer, so a guaranteed way to make the download non-blocking is to trigger it with JS.

D
dtestyk, 2015-03-31
@dtestyk

most likely it is needed so that it is considered only when the page is loaded , and not just the page was started loading or even a separate
ps script is a good way to access the dom without getting (depending on the speed of loading) errors about not found element

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question