@harvard-lts/mirador-analytics-plugin
v2.0.0
Published
mirador-analytics-plugin React component
Downloads
379
Keywords
Readme
mirador-analytics-plugin
Mirador plugin for analytics. Currently formatted for use with Google Tag Manager.
Compatibility
This plugin is compatible with Mirador 4 (React 18/19, MUI 7). It is not
backwards compatible with Mirador 3 — upgrading to Mirador 4 introduced breaking
changes (top-level mirador imports, function/hook components, MUI 7 + Emotion).
Versioning convention:
- Mirador 4 releases are tagged
2.x. - Mirador 3 releases are tagged
0.xor1.x— pin one of these if you still need Mirador 3.
Requirements
Setup
- Run
nvm useto ensure your version of matches that in the.nvmrcfile - Run
npm ito install dependencies - Use one of the NPM scripts to perform the actions described below.
NPM scripts
The following are some useful scripts can be ran using npm run <script>. A full list can be seen in package.json
| Script | Description |
| ------- | -------------------------------------------------------------------------------------------------------------------------- |
| clean | Removes the dist directories |
| build | Builds the source files into the ./dist directory |
| serve | Runs a local web server where the plugin can be viewed in a vanilla Mirador instance (helpful for testing and development) |
| test | Runs the automated test suites
Installing in Mirador
The mirador-analytics-plugin requires an instance of Mirador 4. Visit the Mirador wiki and the Creating a Mirador 4 Plugin page to learn how to install and configure plugins.
Package you will need to install:
npm i @harvard-lts/mirador-analytics-pluginConfiguration
Configurations for this plugin are injected when Mirador is initialized under the miradorAnalyticsPlugin key. See the demo entry for an example of importing and configuring mirador-analytics-plugin.
...
id: 'mirador',
miradorAnalyticsPlugin: {
...
}
...| Config Key | Type | Description |
| --- | --- | --- |
| containerId | string | ID assigned in Google Tag Manager, formatted as GTM-XXXXXXX (this can be found in the top right corner of the Workspace page) |
Contribute
Mirador's development, design, and maintenance is driven by community needs and ongoing feedback and discussion. Join us at our regularly scheduled community calls, on IIIF slack #mirador, or the mirador-tech and iiif-discuss mailing lists. To suggest features, report bugs, and clarify usage, please submit a GitHub issue.
