views:

154

answers:

2

We are trying to use google analytics and hubspot on our site but they bith seem to delay the execution of the scripts on our site.

We are using jQuery and the "ready" function to delay our scripts until the page is ready.

Are there any ways we can delay the analytics scripts and have our scripts execute first?

Thanks.

A: 

Move the script code for GA and Hubspot into another jQuery "ready" function, but after the code you want to run first.

"ready" functions fire when the DOM is ready (the page source is parsed), but before all external resources are loaded. GA script is generally in-line, just before the closing </body> tag, so it runs before "ready" fires.

Steve Madsen
A: 

Best option I have found is just putting this code close to the tag.

ChrisH