You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\*1: According to the their [documentation](https://github.com/btk/nextjs-google-adsense/blob/master/README.md) seems it is ok to use multiple ADs on one page. But I found that it will cause an error.
<GoogleAdSense/> {/* if NEXT_PUBLIC_ADSENSE_PUBLISHER_ID is set */}
92
+
<Component {...pageProps} />
93
+
</>
94
+
);
95
+
};
96
+
97
+
exportdefaultApp;
98
+
```
99
+
You can also add the `publisherId` as environment variable as `NEXT_PUBLIC_ADSENSE_PUBLISHER_ID`. The environment variable will override the prop if both are set.
100
+
101
+
2. Ads.txt snippet
102
+
```json
103
+
// package.json
104
+
105
+
// ...
106
+
"scripts": {
107
+
"build": "next build && create-ads-txt", // 👈 if you want to create ads.txt automatically, recommended
108
+
"create-ads-txt": "create-ads-txt"// 👈 if you want to create ads.txt manually
109
+
},
110
+
// ...
111
+
```
112
+
113
+
> ⚠️ Your old `ads.txt` will be overwritten during the generation process.
114
+
115
+
You must set `NEXT_PUBLIC_ADSENSE_PUBLISHER_ID` as environment variable. The environment variable will be used to generate the `ads.txt`.
90
116
91
-
exportdefaultApp;
92
-
```
93
117
94
-
You can also add the `publisherId` as environment variable as `NEXT_PUBLIC_ADSENSE_PUBLISHER_ID`. The environment variable will override the prop if both are set.
0 commit comments