Web Hosting Talk







View Full Version : Google Adsense - converting "JS" into actual JS code??


Mikhailtech
10-19-2007, 04:05 PM
Hi,

I'm trying to convert Google Adsense Javascript code (the stuff with the < script > tags) into actual Javascript to be saved in a .js file. Why? I need it for ad integration. I used an online converter but all it did was put a bunch of dz.writeIn() code and wrapped it around the Adsense code which didn't make it work at all. Maybe there's something I should omit? Or how does this work? I don't really know much about Javascript.

ilyash
10-19-2007, 07:35 PM
As per Google TOS you can't modify the code in any way... however..

if you take their code and just put it into a file... say... google.js

then you can call on it from your page <script language="text/javascript" src="google.js"></script>

Mikhailtech
10-19-2007, 09:28 PM
Eh I think I may not have clearly expressed the issue. My agency helped me out though. A lot of it was removing the initial < script > tags but there also needed to be a document.write() thing at the end so the last couple script tags remained intact.

It doesn't modify the Google code in the sense that once it's formatted in a web page it shows up identical to how it would if you just cut & pasted the code from Google's site. However, the rather than a direct insertion the code had to be called from a .js file, and you can't just cut & paste the code Google gives you into a .js file and expect it to work. Some minor syntax modifications had to be made.