-
-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Deprecate Google Analytics Integration #2600
Comments
Are you aware of any google analytics plugin? I would like to migrate |
One can be easily constructed from the code in 1b55285 $ typedoc --plugin ./analytics.mjs // @ts-check
// Apache License 2.0 - https://github.com/TypeStrong/typedoc/blob/master/LICENSE
import td from "typedoc";
/** @param {td.Application} app */
export function load(app) {
app.options.addDeclaration({
name: "gaID",
help: "Set the Google Analytics tracking ID and activate tracking code",
type: td.ParameterType.String,
});
app.renderer.hooks.on("body.end", () => {
const gaID = app.options.getValue("gaID");
if (gaID) {
const script = `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${gaID}');
`.trim();
return td.JSX.createElement(td.JSX.Fragment, null, [
td.JSX.createElement("script", {
async: true,
src: "https://www.googletagmanager.com/gtag/js?id=" + gaID,
}),
td.JSX.createElement("script", null, td.JSX.createElement(td.JSX.Raw, { html: script })),
]);
}
return td.JSX.createElement(td.JSX.Fragment, null);
});
} |
I think in the official docs website, |
Fixed with TypeStrong/typedoc-site@c43e28b, thanks |
Hello, this plugin has been done today, it can be found here: https://www.npmjs.com/package/typedoc-plugin-ga Feedback would be nice, also, can it be added to typedoc's documentation, in the plugins' list? |
It will automatically be picked up when the site rebuilds tonight |
It didn't appear |
Ah, that's because you don't have a peerDependency declared. Setting it to 0.26.x will make it show up. |
Oh ok, I had it as dev, thanks |
Search Terms
gaId, privacy, gdpr, cookies
Problem
TypeDoc supports specifying a
gaId
option. When set, this causes TypeDoc to include Google Analytics tracking code in the generated pages. This causes a problem for anyone attempting to comply with the EU Cookie Law as TypeDoc does not generate a cookie banner.Suggested Solution
Push the
gaId
option to an external plugin. I could generate a cookie banner within TypeDoc, but other plugins (like typedoc-clarity-plugin) also ought to cause this to be generated, so TypeDoc's check would have to be externally controlled.The text was updated successfully, but these errors were encountered: