Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-12 16:58:49

immarabi
Member
Registered: 2008-04-29
Posts: 57

can I just insert javascript into a page?

Hi,

can I just insert javascript, such as this script for Google tracking at the bottom of my page?

<script src=“http://www.google-analytics.com/urchin.js” type=“text/javascript”>
</script>
<script type=“text/javascript”>
_uacct = “UA-2350759-7”;
urchinTracker();
</script>

thanks

Offline

#2 2008-05-12 17:07:46

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: can I just insert javascript into a page?

Yes you can, and I think its supposed to go after the end body tag, but I have it before the end body tag, and it works fine.

I put the Google code in a form, then include it in the page.

Offline

#3 2008-05-12 20:04:00

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: can I just insert javascript into a page?

After the </body> tag there should be nothing but </html>.
<script> should go in <head> or <body> or see HTML reference

Offline

#4 2008-05-12 20:06:29

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: can I just insert javascript into a page?

Correct Ruud – but that is what Google say to do…!

Offline

#5 2008-05-12 22:00:23

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: can I just insert javascript into a page?

Google says (emphasis mine)

We generally recommend that you place the Google Analytics tracking code immediately before the closing </body> tag of your pages in order to avoid any issues with page loading delays for visitors with slow connection speeds. However, there are several situations where it might make more sense for you to install the code in the head

Offline

#6 2008-05-13 06:10:25

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: can I just insert javascript into a page?

You are right! I should not have said anything, because I too have the tracking code just before the end body tag. But I could have sworn they said after the end body tag…!!

Offline

#7 2008-09-06 00:27:03

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: can I just insert javascript into a page?

I have installed the Google analytics code in a form and i am loading it into all my pages.
Google says the script is installed but is not tracking anything at all…

Is there something I am doing wrong?

Offline

#8 2008-09-06 08:17:40

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: can I just insert javascript into a page?

There is some delay between install and furst data – use google help center – this question is there.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

Board footer

Powered by FluxBB