Welcome to WebmasterWorld Guest from

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Call Google Analytics from an external JS file?

4:11 am on Nov 6, 2007 (gmt 0)

New User

10+ Year Member

joined:Mar 11, 2005
votes: 0

Iíve got to deploy Google Analytics across several different websites that have 50+ pages each but each site uses the same proprietary CMS that does not have a common header, footer, or any sort of snippet that I can access. So I have to access each page via this pain-in-the-rear CMS and add the code. Iím concerned that if I ever want to change the GA code with one of the many hacks out there Iíd have to go to every single page and modify it.

Is it possible to put the GA code in an external file? I would host this external file on server A and it would be called by the website which lives on server B.

Thank you.


6:00 am on Nov 17, 2007 (gmt 0)

New User

10+ Year Member

joined:Feb 12, 2003
votes: 0

Certainly, Google Analytics can be called from an external js file.

I saved [google-analytics.com...] into my website and hacked the code, everything works fine.

GA gather all data as parameters of [google-analytics.com...] GA do not care where the js file is.