UNPKG

nextjs-google-adsense

Version:
18 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoogleAdSense = void 0; const tslib_1 = require("tslib"); const react_1 = tslib_1.__importDefault(require("react")); const script_1 = tslib_1.__importDefault(require("next/script")); function GoogleAdSense({ publisherId, strategy = "afterInteractive", debug = false }) { var _a; const _publisherId = (_a = process.env.NEXT_PUBLIC_ADSENSE_PUBLISHER_ID) !== null && _a !== void 0 ? _a : publisherId; if (!_publisherId) { console.error("nextjs-google-adsense: publisherId can't be empty for GoogleAdSense component"); return null; } return (react_1.default.createElement(react_1.default.Fragment, null, react_1.default.createElement(script_1.default, { id: "nextjs-google-adsense", src: `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-${_publisherId}${debug ? `google_console=1` : ``}`, strategy: strategy }))); } exports.GoogleAdSense = GoogleAdSense; //# sourceMappingURL=GoogleAdSense.js.map