Title: Why does script load before in the
Last modified: June 24, 2022

---

# Why does script load before in the

 *  Resolved [wordmax](https://wordpress.org/support/users/wordmax/)
 * (@wordmax)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/why-does-script-load-before-in-the/)
 * Just curious, is there a reason why you have the script loading before the <title
   > in the page/post code? Most other scripts run after all the basic html meta
   is loaded in the <head>
 * `<script>window.koko_analytics={"tracker_url":"https:\/\/mywebsite.com\/koko-
   analytics-collect.php","post_id":0,"use_cookie":1,"cookie_path":"\/","honor_dnt":!
   0}</script>`
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [wordmax](https://wordpress.org/support/users/wordmax/)
 * (@wordmax)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/why-does-script-load-before-in-the/#post-15770411)
 * Sorry somehow this posts got posted w/ wrong info.
 * Is there a reason the plugin code script is running before the html title in 
   the code? Most other add on plugins/codes run after the primary html data before
   the closing head tag.
 * Thanks
 *  Plugin Support [Lap](https://wordpress.org/support/users/lapzor/)
 * (@lapzor)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/why-does-script-load-before-in-the/#post-15770767)
 * The Koko script isn’t actually doing the tracking before the title. That 1 line
   of Javascript code you find there contains the settings for Koko.
 * The Koko script itself runs in the end just before the </body>
 * I’m not 100% sure why it’s in the header, would have to ask Danny about that,
   but I assume it’s to make 100% sure that those settings are available to koko
   by the time the koko script itself executes as it can be tricky to control in
   what order WordPress loads plugins/scripts.
 * Anyway, it won’t slow down your site as it isn’t doing any work yet when it’s
   loading the settings.
 * Hope that helps. If you have any questions, please let me know!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Why does script load before in the’ is closed to new replies.

 * ![](https://ps.w.org/koko-analytics/assets/icon.svg?rev=2980600)
 * [Koko Analytics - Privacy-Friendly WordPress Analytics](https://wordpress.org/plugins/koko-analytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/koko-analytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/koko-analytics/)
 * [Active Topics](https://wordpress.org/support/plugin/koko-analytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/koko-analytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/koko-analytics/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Lap](https://wordpress.org/support/users/lapzor/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/why-does-script-load-before-in-the/#post-15770767)
 * Status: resolved