|
1 |
| -exports.onPreInit = ({ reporter }, options) => { |
2 |
| - if (!options.trackingId) { |
3 |
| - reporter.warn( |
4 |
| - `The Google Analytics plugin requires a tracking ID. Did you mean to add it?` |
5 |
| - ) |
6 |
| - } |
7 |
| -} |
| 1 | +exports.pluginOptionsSchema = ({ Joi }) => |
| 2 | + Joi.object({ |
| 3 | + trackingId: Joi.string() |
| 4 | + .required() |
| 5 | + .description( |
| 6 | + `The property ID; the tracking code won't be generated without it` |
| 7 | + ), |
| 8 | + head: Joi.boolean() |
| 9 | + .default(false) |
| 10 | + .description( |
| 11 | + `Defines where to place the tracking script - \`true\` in the head and \`false\` in the body` |
| 12 | + ), |
| 13 | + anonymize: Joi.boolean().default(false), |
| 14 | + respectDNT: Joi.boolean().default(false), |
| 15 | + exclude: Joi.array() |
| 16 | + .items(Joi.string()) |
| 17 | + .default([]) |
| 18 | + .description(`Avoids sending pageview hits from custom paths`), |
| 19 | + pageTransitionDelay: Joi.number() |
| 20 | + .default(0) |
| 21 | + .description( |
| 22 | + `Delays sending pageview hits on route update (in milliseconds)` |
| 23 | + ), |
| 24 | + optimizeId: Joi.string().description( |
| 25 | + `Enables Google Optimize using your container Id` |
| 26 | + ), |
| 27 | + experimentId: Joi.string().description( |
| 28 | + `Enables Google Optimize Experiment ID` |
| 29 | + ), |
| 30 | + variationId: Joi.string().description( |
| 31 | + `Set Variation ID. 0 for original 1,2,3....` |
| 32 | + ), |
| 33 | + defer: Joi.boolean().description( |
| 34 | + `Defers execution of google analytics script after page load` |
| 35 | + ), |
| 36 | + sampleRate: Joi.number(), |
| 37 | + siteSpeedSampleRate: Joi.number(), |
| 38 | + cookieDomain: Joi.string(), |
| 39 | + }) |
0 commit comments