OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Regarding the issue of opening and closing the testing mode in Google Adsense

  • Thread starter Thread starter 李晓川
  • Start date Start date

李晓川

Guest
When testing locally, I need to turn on the testing mode, so I need to add 'data-adbreak-test': 'on' to the script. However, this attribute needs to be deleted in a production environment.

dev:

Code:
{
    async: true,
    src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
    'data-ad-client': process.env.NUXT_PUBLIC_ADSENSE_CLIENT_ID,
    'data-ad-frequency-hint': '30s',
    'data-adbreak-test': 'on'  // open testing mode
},

prod

Code:
{
    async: true,
    src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
    'data-ad-client': process.env.NUXT_PUBLIC_ADSENSE_CLIENT_ID,
    'data-ad-frequency-hint': '30s',
    // 'data-adbreak-test': 'on'  // close testing mode
},

It needs to be commented out every time before going online. The operation is too cumbersome, and it is easy to forget to comment. Cause errors in the production environment. Is there a value similar to 'off' to disable testing mode? In this case, I can control whether testing mode needs to be turned on through Nuxt environment variables.

I checked the documentation and didn't find any other values besides 'on'google adsense doc

Or is there any other way that can be automatically controlled without manual annotation?

I have tried 'data-adbreak-test': 'off' and 'data-adbreak-test': '' with no effect
<p>When testing locally, I need to turn on the testing mode, so I need to add <code>'data-adbreak-test': 'on'</code> to the script.
However, this attribute needs to be deleted in a production environment.</p>
<p>dev:</p>
<pre><code>{
async: true,
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
'data-ad-client': process.env.NUXT_PUBLIC_ADSENSE_CLIENT_ID,
'data-ad-frequency-hint': '30s',
'data-adbreak-test': 'on' // open testing mode
},
</code></pre>
<p>prod</p>
<pre><code>{
async: true,
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
'data-ad-client': process.env.NUXT_PUBLIC_ADSENSE_CLIENT_ID,
'data-ad-frequency-hint': '30s',
// 'data-adbreak-test': 'on' // close testing mode
},
</code></pre>
<p>It needs to be commented out every time before going online. The operation is too cumbersome, and it is easy to forget to comment. Cause errors in the production environment. Is there a value similar to <code>'off'</code> to disable testing mode? In this case, I can control whether testing mode needs to be turned on through Nuxt environment variables.</p>
<p>I checked the documentation and didn't find any other values besides <code>'on'</code><a href="https://support.google.com/adsense/answer/9955214?hl=en" rel="nofollow noreferrer">google adsense doc</a></p>
<p>Or is there any other way that can be automatically controlled without manual annotation?</p>
<p>I have tried <code>'data-adbreak-test': 'off'</code> and <code>'data-adbreak-test': ''</code> with no effect</p>
 

Latest posts

Top