Reputation: 59634
I am working on websites that will contain adds. However, I don't want these ads to be displayed during development.
Is there any easy way to disable the Javascript code generated by Google adsense? A flag for example? Should I fiddle something in JQuery document ready? Looking for a clean and easy solution. Thanks.
Upvotes: 4
Views: 239
Reputation: 268462
You definitely could wrap the Adsense JavaScript in a conditional statement, and set a flag yourself at the top of your document if you wanted; just be sure to strip it out in your build process, or whenever you're ready to ship your code.
While this is technically possible, I would probably suggest against it. I wouldn't worry too much about screwing up your reporting or anything - as was pointed out in the comments on your question, Google isn't exactly new at this; they can determine when it's a good time to show money-making advertisements, and when it's a good time to just toss in some fillers.
Please note that I do not represent Google, and I cannot say what activity will have your account(s) with them suspended. If you wish to protect yourself from accidental clicks, I would suggest you go ahead and disable the ads while in development. Better safe than sorry.
Upvotes: 3