I am fixing a template that we use on one of our sites, which has the following code
This snippet works.
<script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"></script> <script type="text/javascript"> GS_googleAddAdSenseService("ca-pub-123"); GS_googleEnableAllServices(); </script> <script type="text/javascript"> GA_googleAddSlot("ca-pub-123", "Foo"); GA_googleAddSlot("ca-pub-123", "Bar"); </script> <script type="text/javascript"> GA_googleFetchAds(); </script>
I tried combining static scripts like this
<script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"></script> <script type="text/javascript"> GS_googleAddAdSenseService("ca-pub-123"); GS_googleEnableAllServices(); GA_googleAddSlot("ca-pub-123", "Foo"); GA_googleAddSlot("ca-pub-123", "Bar"); GA_googleFetchAds(); </script>
However, now I get an error
Uncaught ReferenceError: GA_googleAddSlot is not defined
I'm not a noob when it comes to JavaScript, but I can't imagine why a combination of three built-in scripts into a single <script> would make a difference here.
Any ideas?
source share