Comments (9)
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);
});
}
from typedoc.
Fixed with TypeStrong/typedoc-site@c43e28b, thanks
from typedoc.
Are you aware of any google analytics plugin? I would like to migrate
from typedoc.
I think in the official docs website, gaId
is still specified as a possible option
from typedoc.
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); }); }
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?
from typedoc.
It will automatically be picked up when the site rebuilds tonight
from typedoc.
It didn't appear
from typedoc.
Ah, that's because you don't have a peerDependency declared. Setting it to 0.26.x will make it show up.
from typedoc.
Oh ok, I had it as dev, thanks
from typedoc.
Related Issues (20)
- @link not resolving across packages HOT 7
- How to apply to annotations after adding members to this TranslatableStrings interface HOT 1
- The right way to document param of a param function HOT 5
- The sorting strategy "alphabetical" should use localeCompare() HOT 1
- Add option to choose whether to expose all re-exports in sidebar HOT 2
- [question] ComplexGenericTypeAlias defined but never be used. HOT 1
- Relative links containing fragment trigger false-positive about missing files HOT 1
- [question] what's the meaning of ` handle links to models`? HOT 3
- [question] Why there say: `determine how the project model is generated and output to disk.`? is it means the Options is very important, participated in the whole execution process of TypeDoc? HOT 1
- [question] What's the relationship between `Components` and `Options, Plugins and Converters`? HOT 1
- [question] Why define enum by `[ts.SymbolFlags.RegularEnum]: convertEnum`? HOT 3
- Add support for `@abstract` tag HOT 1
- "minimatch/dist/commonjs/index"' has no exported member 'IOptions' HOT 3
- [question] How does TypeDoc obtain the Class Hierarchy data? HOT 1
- How to remap filenames while keeping the grouping by folder? HOT 1
- Is there a way to format the documentation of a constant object in the same way as an interface HOT 5
- Incorrect placement of default values when function not using the `this` parameter `satisfies` an interface that DOES use the `this` parameter HOT 1
- Support TypeScript 5.6 HOT 1
- [regression] @link to built-in methods fails since 0.26.7
- The @defaultValue tag can not transform to “zh_cn” language HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typedoc.