File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,22 @@ export function useScriptGoogleAdsense<T extends GoogleAdsenseApi>(_options?: Go
7272
7373Please follow the [ Registry Scripts] ( /docs/guides/registry-scripts ) guide to learn more about advanced usage.
7474
75+ ### Site Ownership Verification
76+
77+ When a ` client ` is provided, a meta tag will be inserted on the page so that Google can verify your site ownership.
78+
79+ ``` ts
80+ const adsense = useScriptGoogleAdsense ({
81+ client: ' ca-pub-<your-id>' ,
82+ })
83+ ```
84+
85+ The generated meta tag will look like this:
86+
87+ ``` html
88+ <meta name =" google-adsense-account" content =" ca-pub-<your-id>" >
89+ ```
90+
7591### GoogleAdsenseApi
7692
7793``` ts
Original file line number Diff line number Diff line change 1- import { optional } from 'valibot'
21import { useRegistryScript } from '../utils'
3- import { object , string } from '#nuxt-scripts-validator'
2+ import { object , string , optional } from '#nuxt-scripts-validator'
43import type { RegistryScriptInput } from '#nuxt-scripts'
54import { useHead } from '#imports'
65
@@ -40,21 +39,17 @@ export function useScriptGoogleAdsense<T extends GoogleAdsenseApi>(_options?: Go
4039 use ( ) {
4140 return { adsbygoogle : window . adsbygoogle }
4241 } ,
43- // allow dataLayer to be accessed on the server
44- stub : import . meta. client
45- ? undefined
46- : ( { fn } ) => {
47- return fn === 'adsbygoogle' ? [ ] : undefined
48- } ,
4942 beforeInit ( ) {
50- useHead ( {
51- meta : [
52- {
53- name : 'google-adsense-account' ,
54- content : options ?. client ,
55- } ,
56- ] ,
57- } )
43+ if ( options ?. client ) {
44+ useHead ( {
45+ meta : [
46+ {
47+ name : 'google-adsense-account' ,
48+ content : options ?. client ,
49+ } ,
50+ ] ,
51+ } )
52+ }
5853 } ,
5954 } ,
6055 } ) , _options )
You can’t perform that action at this time.
0 commit comments