docusaurus/assets/js/c459a19d.42c493ba.js
2024-10-17 11:56:57 +00:00

1 line
No EOL
15 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["12395"],{80296:function(e,r,n){n.r(r),n.d(r,{metadata:()=>t,contentTitle:()=>u,default:()=>h,assets:()=>d,toc:()=>p,frontMatter:()=>s});var t=JSON.parse('{"id":"api/plugins/plugin-vercel-analytics","title":"\uD83D\uDCE6 plugin-vercel-analytics","description":"Vercel Analytics provides comprehensive insights into your website\'s visitors, tracking top pages, referrers, and demographics like location, operating systems, and browser info.","source":"@site/docs/api/plugins/plugin-vercel-analytics.mdx","sourceDirName":"api/plugins","slug":"/api/plugins/@docusaurus/plugin-vercel-analytics","permalink":"/docs/api/plugins/@docusaurus/plugin-vercel-analytics","draft":false,"unlisted":false,"editUrl":"https://github.com/facebook/docusaurus/edit/main/website/docs/api/plugins/plugin-vercel-analytics.mdx","tags":[],"version":"current","lastUpdatedBy":"S\xe9bastien Lorber","lastUpdatedAt":1729166052000,"sidebarPosition":11,"frontMatter":{"sidebar_position":11,"slug":"/api/plugins/@docusaurus/plugin-vercel-analytics"},"sidebar":"api","previous":{"title":"\uD83D\uDCE6 plugin-sitemap","permalink":"/docs/api/plugins/@docusaurus/plugin-sitemap"},"next":{"title":"Themes overview","permalink":"/docs/api/themes"}}'),a=n("24246"),i=n("80980"),o=n("15398"),l=n("58636"),c=n("32240");let s={sidebar_position:11,slug:"/api/plugins/@docusaurus/plugin-vercel-analytics"},u="\uD83D\uDCE6 plugin-vercel-analytics",d={},p=[{value:"Installation",id:"installation",level:2},{value:"Configuration",id:"configuration",level:2},{value:"Example configuration",id:"ex-config",level:3}];function f(e){let r={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.header,{children:(0,a.jsx)(r.h1,{id:"-plugin-vercel-analytics",children:"\uD83D\uDCE6 plugin-vercel-analytics"})}),"\n","\n",(0,a.jsxs)(r.p,{children:[(0,a.jsx)(r.a,{href:"https://vercel.com/docs/analytics",children:"Vercel Analytics"})," provides comprehensive insights into your website's visitors, tracking top pages, referrers, and demographics like location, operating systems, and browser info."]}),"\n",(0,a.jsx)(r.admonition,{title:"production only",type:"warning",children:(0,a.jsxs)(r.p,{children:["This plugin is always inactive in development and ",(0,a.jsx)(r.strong,{children:"only active in production"})," (",(0,a.jsx)(r.code,{children:"docusaurus build"}),") to avoid polluting the analytics statistics."]})}),"\n",(0,a.jsx)(r.h2,{id:"installation",children:"Installation"}),"\n",(0,a.jsxs)(o.Z,{groupId:"npm2yarn",children:[(0,a.jsx)(l.Z,{value:"npm",children:(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-bash",children:"npm install --save @docusaurus/plugin-vercel-analytics\n"})})}),(0,a.jsx)(l.Z,{value:"yarn",label:"Yarn",children:(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-bash",children:"yarn add @docusaurus/plugin-vercel-analytics\n"})})}),(0,a.jsx)(l.Z,{value:"pnpm",label:"pnpm",children:(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-bash",children:"pnpm add @docusaurus/plugin-vercel-analytics\n"})})})]}),"\n",(0,a.jsx)(r.h2,{id:"configuration",children:"Configuration"}),"\n",(0,a.jsx)(r.p,{children:"Accepted fields:"}),"\n",(0,a.jsx)(c.Z,{children:(0,a.jsxs)(r.table,{children:[(0,a.jsx)(r.thead,{children:(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.th,{children:"Name"}),(0,a.jsx)(r.th,{children:"Type"}),(0,a.jsx)(r.th,{children:"Default"}),(0,a.jsx)(r.th,{children:"Description"})]})}),(0,a.jsxs)(r.tbody,{children:[(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.td,{children:(0,a.jsx)(r.code,{children:"mode"})}),(0,a.jsx)(r.td,{children:(0,a.jsx)(r.code,{children:"string"})}),(0,a.jsx)(r.td,{children:(0,a.jsx)(r.code,{children:"'auto'"})}),(0,a.jsxs)(r.td,{children:["Override the automatic environment detection. Read the ",(0,a.jsx)(r.a,{href:"https://vercel.com/docs/analytics/package#mode",children:"official docs"})," for details."]})]}),(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.td,{children:(0,a.jsx)(r.code,{children:"debug"})}),(0,a.jsx)(r.td,{children:(0,a.jsx)(r.code,{children:"boolean"})}),(0,a.jsx)(r.td,{children:(0,a.jsx)(r.code,{children:"undefined"})}),(0,a.jsxs)(r.td,{children:["Enable browser console logging of analytics events. Read the ",(0,a.jsx)(r.a,{href:"https://vercel.com/docs/analytics/package#debug",children:"official docs"})," for details."]})]})]})]})}),"\n",(0,a.jsx)(r.h3,{id:"ex-config",children:"Example configuration"}),"\n",(0,a.jsx)(r.p,{children:"You can configure this plugin through plugin options."}),"\n",(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-js",metastring:'title="docusaurus.config.js"',children:"export default {\n plugins: [\n [\n 'vercel-analytics',\n {\n debug: true,\n mode: 'auto',\n },\n ],\n ],\n};\n"})})]})}function h(e={}){let{wrapper:r}={...(0,i.a)(),...e.components};return r?(0,a.jsx)(r,{...e,children:(0,a.jsx)(f,{...e})}):f(e)}},58636:function(e,r,n){n.d(r,{Z:()=>o});var t=n("24246");n("27378");var a=n("90496");let i="tabItem_pnkT";function o(e){var r=e.children,n=e.hidden,o=e.className;return(0,t.jsx)("div",{role:"tabpanel",className:(0,a.Z)(i,o),hidden:n,children:r})}},15398:function(e,r,n){n.d(r,{Z:()=>k});var t=n("24246"),a=n("27378"),i=n("90496"),o=n("54947"),l=n("3620"),c=n("844"),s=n("97486"),u=n("32263"),d=n("16971");function p(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function f(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n,t,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(i.push(n.value),!r||i.length!==r);o=!0);}catch(e){l=!0,t=e}finally{try{!o&&null!=a.return&&a.return()}finally{if(l)throw t}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return p(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,r)}}(e,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var r,n;return null!==(n=null===(r=a.Children.toArray(e).filter(function(e){return"\n"!==e}).map(function(e){var r,n;if(!e||(0,a.isValidElement)(e)&&(r=e.props)&&(void 0===r?"undefined":(n=r)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)=="object"&&"value"in r)return e;throw Error("Docusaurus error: Bad <Tabs> child <".concat("string"==typeof e.type?e.type:e.type.name,'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.'))}))||void 0===r?void 0:r.filter(Boolean))&&void 0!==n?n:[]}function b(e){var r=e.value;return e.tabValues.some(function(e){return e.value===r})}var v=n("71607");let g="tabList_Qoir",y="tabItem_AQgk";function m(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){var t,a,i;t=e,a=r,i=n[r],a in t?Object.defineProperty(t,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[a]=i})}return e}function j(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}),e}function x(e){var r=e.className,n=e.block,a=e.selectedValue,l=e.selectValue,c=e.tabValues,s=[],u=(0,o.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var r=e.currentTarget,n=c[s.indexOf(r)].value;n!==a&&(u(r),l(n))},p=function(e){var r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,t=s.indexOf(e.currentTarget)+1;r=null!==(n=s[t])&&void 0!==n?n:s[0];break;case"ArrowLeft":var a,i=s.indexOf(e.currentTarget)-1;r=null!==(a=s[i])&&void 0!==a?a:s[s.length-1]}null==r||r.focus()};return(0,t.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,i.Z)("tabs",{"tabs--block":n},r),children:c.map(function(e){var r=e.value,n=e.label,o=e.attributes;return(0,t.jsx)("li",j(m({role:"tab",tabIndex:a===r?0:-1,"aria-selected":a===r,ref:function(e){return s.push(e)},onKeyDown:p,onClick:d},o),{className:(0,i.Z)("tabs__item",y,null==o?void 0:o.className,{"tabs__item--active":a===r}),children:null!=n?n:r}),r)})})}function w(e){var r=e.lazy,n=e.children,o=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(r){var c=l.find(function(e){return e.props.value===o});return c?(0,a.cloneElement)(c,{className:(0,i.Z)("margin-top--md",c.props.className)}):null}return(0,t.jsx)("div",{className:"margin-top--md",children:l.map(function(e,r){return(0,a.cloneElement)(e,{key:r,hidden:e.props.value!==o})})})}function O(e){var r=function(e){var r,n,t,i,o,p,v,g,y,m,j,x,w,O,k=e.defaultValue,S=e.queryString,P=e.groupId;var A=(n=(r=e).values,t=r.children,(0,a.useMemo)(function(){var e=null!=n?n:h(t).map(function(e){var r=e.props;return{value:r.value,label:r.label,attributes:r.attributes,default:r.default}});return!function(e){var r=(0,u.lx)(e,function(e,r){return e.value===r.value});if(r.length>0)throw Error('Docusaurus error: Duplicate values "'.concat(r.map(function(e){return e.value}).join(", "),'" found in <Tabs>. Every value needs to be unique.'))}(e),e},[n,t])),E=f((0,a.useState)(function(){return function(e){var r,n=e.defaultValue,t=e.tabValues;if(0===t.length)throw Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!b({value:n,tabValues:t}))throw Error('Docusaurus error: The <Tabs> has a defaultValue "'.concat(n,'" but none of its children has the corresponding value. Available values are: ').concat(t.map(function(e){return e.value}).join(", "),". If you intend to show no default tab, use defaultValue={null} instead."));return n}var a=null!==(r=t.find(function(e){return e.default}))&&void 0!==r?r:t[0];if(!a)throw Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:k,tabValues:A})}),2),I=E[0],T=E[1];var V=f((o=(i={queryString:void 0!==S&&S,groupId:P}).queryString,p=i.groupId,v=(0,l.k6)(),g=function(e){var r=e.queryString,n=void 0!==r&&r,t=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=t?t:null}({queryString:void 0!==o&&o,groupId:p}),[(0,s._X)(g),(0,a.useCallback)(function(e){if(!!g){var r,n,t=new URLSearchParams(v.location.search);t.set(g,e),v.replace((r=function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){var t,a,i;t=e,a=r,i=n[r],a in t?Object.defineProperty(t,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[a]=i})}return e}({},v.location),n=(n={search:t.toString()},n),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r))}},[g,v])]),2),N=V[0],C=V[1];var D=f((m=(y=({groupId:P}).groupId)?"docusaurus.tab.".concat(y):null,x=(j=f((0,d.Nk)(m),2))[0],w=j[1],[x,(0,a.useCallback)(function(e){if(!!m)w.set(e)},[m,w])]),2),Z=D[0],q=D[1];var _=b({value:O=null!=N?N:Z,tabValues:A})?O:null;return(0,c.Z)(function(){_&&T(_)},[_]),{selectedValue:I,selectValue:(0,a.useCallback)(function(e){if(!b({value:e,tabValues:A}))throw Error("Can't select invalid tab value=".concat(e));T(e),C(e),q(e)},[C,q,A]),tabValues:A}}(e);return(0,t.jsxs)("div",{className:(0,i.Z)("tabs-container",g),children:[(0,t.jsx)(x,m({},r,e)),(0,t.jsx)(w,m({},r,e))]})}function k(e){var r=(0,v.Z)();return(0,t.jsx)(O,j(m({},e),{children:h(e.children)}),String(r))}},32240:function(e,r,n){n.d(r,{Z:()=>d});var t=n("24246"),a=n("27378"),i=n("96700"),o=n("3620");let l="apiTable_e8hp";function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function s(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n,t,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(i.push(n.value),!r||i.length!==r);o=!0);}catch(e){l=!0,t=e}finally{try{!o&&null!=a.return&&a.return()}finally{if(l)throw t}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return c(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,r)}}(e,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var u=a.forwardRef(function(e,r){var n=e.name,l=e.children,c=function(e){for(var r=e;(0,a.isValidElement)(r);)r=s(a.Children.toArray(r.props.children),1)[0];if("string"!=typeof r)throw Error("Could not extract APITable row name from JSX tree:\n".concat(JSON.stringify(e,null,2)));return r}(l),u=n?"".concat(n,"-").concat(c):c,d="#".concat(u),p=(0,o.k6)();return(0,i.Z)().collectAnchor(u),(0,t.jsx)("tr",{id:u,tabIndex:0,ref:p.location.hash===d?r:void 0,onClick:function(e){var r,n="TD"===e.target.tagName.toUpperCase(),t=!!(null===(r=window.getSelection())||void 0===r?void 0:r.toString());n&&!t&&p.push(d)},onKeyDown:function(e){"Enter"===e.key&&p.push(d)},children:l.props.children})});function d(e){var r=e.children,n=e.name;if("table"!==r.type)throw Error("Bad usage of APITable component.\nIt is probably that your Markdown table is malformed.\nMake sure to double-check you have the appropriate number of columns for each table row.");var i=s(a.Children.toArray(r.props.children),2),o=i[0],c=i[1],d=(0,a.useRef)(null);(0,a.useEffect)(function(){var e;null===(e=d.current)||void 0===e||e.focus()},[d]);var p=a.Children.map(c.props.children,function(e){return(0,t.jsx)(u,{name:n,ref:d,children:e})});return(0,t.jsxs)("table",{className:l,children:[o,(0,t.jsx)("tbody",{children:p})]})}},80980:function(e,r,n){n.d(r,{Z:function(){return l},a:function(){return o}});var t=n(27378);let a={},i=t.createContext(a);function o(e){let r=t.useContext(i);return t.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function l(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),t.createElement(i.Provider,{value:r},e.children)}}}]);