{"_id":"@elianvancutsem/mostvisitedpages","_rev":"9-439d34b735c0a94a3c6fc16d96b93c89","time":{"0.0.1":"2021-09-30T20:57:05.641Z","created":"2021-10-01T21:02:21.726Z","0.0.5":"2021-10-01T21:02:21.968Z","modified":"2022-04-05T07:11:33.549Z","0.0.6":"2021-10-01T21:34:36.985Z","0.0.7":"2021-10-06T04:33:57.508Z","0.0.8":"2021-10-06T14:42:51.919Z","0.0.9":"2021-10-12T20:46:04.692Z"},"name":"@elianvancutsem/mostvisitedpages","dist-tags":{"latest":"0.0.9"},"versions":{"0.0.5":{"name":"@elianvancutsem/mostvisitedpages","version":"0.0.5","description":"This package fetches and returns your most viewed pages based on Google Analytics","main":"dist/index.js","types":"dist/index.d.ts","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"repository":{"type":"git","url":"git+https://github.com/ElianVanCutsem/MostVisitedPages.git"},"bugs":{"url":"https://github.com/ElianVanCutsem/MostVisitedPages/issues"},"keywords":["Google","Analytics"],"author":{"name":"Elian Van Cutsem","email":"hello@elian.codes","url":"https://www.elian.codes"},"license":"ISC","dependencies":{"@google-analytics/data":"^2.7.0"},"devDependencies":{"typescript":"^4.4.3"},"gitHead":"3fbcd832338fdc11912310dfb3b6329a9170af4e","homepage":"https://github.com/ElianVanCutsem/MostVisitedPages#readme","_id":"@elianvancutsem/mostvisitedpages@0.0.5","_nodeVersion":"16.10.0","_npmVersion":"7.20.3","dist":{"integrity":"sha512-Kp1zjB3EimfxDZrM3yfpkou5gQCTVURMnpkR92+rBlB8iUmcj86uaUXVlCsZVCvoS++2Egvabdu7zZ0SBWgF3A==","shasum":"9c95b143669a72c4d9624d8e9ad2073c82578137","tarball":"https://registry.npmjs.org/@elianvancutsem/mostvisitedpages/-/mostvisitedpages-0.0.5.tgz","fileCount":10,"unpackedSize":8631,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRcOsGnH9GrLP+8PL/wZoVCDeTAUruQNu0FweX7Luf2wIgNS+JyvrA+PehJuz+nItNBaY6qv96tZyjHgnXd8Qj1+U="}]},"_npmUser":{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"},"directories":{},"maintainers":[{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mostvisitedpages_0.0.5_1633122141801_0.09023437586404737"},"_hasShrinkwrap":false},"0.0.6":{"name":"@elianvancutsem/mostvisitedpages","version":"0.0.6","description":"This package fetches and returns your most viewed pages based on Google Analytics","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","publish":"npm run build && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/ElianVanCutsem/MostVisitedPages.git"},"bugs":{"url":"https://github.com/ElianVanCutsem/MostVisitedPages/issues"},"keywords":["Google","Analytics"],"author":{"name":"Elian Van Cutsem","email":"hello@elian.codes","url":"https://www.elian.codes"},"license":"ISC","dependencies":{"@google-analytics/data":"^2.7.0"},"devDependencies":{"typescript":"^4.4.3"},"gitHead":"eea49f85339c0868e61aa045c00cd77f79c62b80","homepage":"https://github.com/ElianVanCutsem/MostVisitedPages#readme","_id":"@elianvancutsem/mostvisitedpages@0.0.6","_nodeVersion":"16.10.0","_npmVersion":"7.20.3","dist":{"integrity":"sha512-x/JpOokk/JojUo9xG8ZqoEAvUwUFpM86piI1kUaULbT7CVQFuUSevSaGL/Kf9HWf3wK7DO5RF+GHmbBzGFm3pg==","shasum":"aa7273b3cf5c9c0c82d83bb418a34c67ddf5b3ec","tarball":"https://registry.npmjs.org/@elianvancutsem/mostvisitedpages/-/mostvisitedpages-0.0.6.tgz","fileCount":10,"unpackedSize":8976,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEBghtKg0LOnbbYfqnJNlqlfSRD5A71cSBYG3Wi2e6FkAiEAlrLsyl1fceyZiSotLVEnQPDrjMikJWdSqYmTLhbV5MQ="}]},"_npmUser":{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"},"directories":{},"maintainers":[{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mostvisitedpages_0.0.6_1633124076659_0.0874260101541593"},"_hasShrinkwrap":false},"0.0.7":{"name":"@elianvancutsem/mostvisitedpages","version":"0.0.7","description":"This package fetches and returns your most viewed pages based on Google Analytics","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","publish":"npm run build && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/ElianVanCutsem/MostVisitedPages.git"},"bugs":{"url":"https://github.com/ElianVanCutsem/MostVisitedPages/issues"},"keywords":["Google","Analytics"],"author":{"name":"Elian Van Cutsem","email":"hello@elian.codes","url":"https://www.elian.codes"},"license":"ISC","dependencies":{"@google-analytics/data":"^2.7.0"},"devDependencies":{"typescript":"^4.4.3"},"gitHead":"e2eb846246bb6e70e88388fad2136b989479b6eb","homepage":"https://github.com/ElianVanCutsem/MostVisitedPages#readme","_id":"@elianvancutsem/mostvisitedpages@0.0.7","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-2I3qdqfYh1aecmQ36PQd4ytG/8Ozg4ZiHMWZkRap1TvzuwXD/9nA2ByAd8fyWRGSdZELsk930xH2M87aXLKjqA==","shasum":"a43d8a619585486f199eaa232ee819ddd7f31247","tarball":"https://registry.npmjs.org/@elianvancutsem/mostvisitedpages/-/mostvisitedpages-0.0.7.tgz","fileCount":10,"unpackedSize":9565,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF1x65LMMErwNqzW/d2gYD2/eVrBxkaGk0npJsjrRmtAAiEAveCXM/0SCZZxs1OcEc2mxUfEjh5uf+Ly+vreMmmvCrw="}]},"_npmUser":{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"},"directories":{},"maintainers":[{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mostvisitedpages_0.0.7_1633494837130_0.06979642565118827"},"_hasShrinkwrap":false},"0.0.8":{"name":"@elianvancutsem/mostvisitedpages","version":"0.0.8","description":"This package fetches and returns your most viewed pages based on Google Analytics","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","exports":{"import":"./dist/index.js","require":"./dist/index.js"},"scripts":{"test":"package-check","build":"tsc","publish":"npm run build && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/ElianVanCutsem/MostVisitedPages.git"},"bugs":{"url":"https://github.com/ElianVanCutsem/MostVisitedPages/issues"},"keywords":["Google","Analytics"],"author":{"name":"Elian Van Cutsem","email":"hello@elian.codes","url":"https://www.elian.codes"},"license":"ISC","dependencies":{"@google-analytics/data":"^2.7.0"},"devDependencies":{"@skypack/package-check":"^0.2.2","typescript":"^4.4.3"},"gitHead":"64524c8d1e11ebe154de6cce66bd55cc16bdca0b","homepage":"https://github.com/ElianVanCutsem/MostVisitedPages#readme","_id":"@elianvancutsem/mostvisitedpages@0.0.8","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-c3w2SeySLnHSU/UNi0V4pOJ/KY3bawAmcfPKFs3sc91GmV5+6C+1N38jPKYmzJG6FRSapfXh62bEHWJFbf/Rug==","shasum":"852ba0b9bc93be0ead746fd87e167994a6605553","tarball":"https://registry.npmjs.org/@elianvancutsem/mostvisitedpages/-/mostvisitedpages-0.0.8.tgz","fileCount":10,"unpackedSize":10332,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDR7GVuLsgFoECH7LVW1FHKYxvrqPQWevqpYFE3Qqo9sgIgdpCPxCdPVrQWvsLIStaKv4zyljbwCyqIrSrDxU2XzGM="}]},"_npmUser":{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"},"directories":{},"maintainers":[{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mostvisitedpages_0.0.8_1633531371799_0.10038198764387829"},"_hasShrinkwrap":false},"0.0.9":{"name":"@elianvancutsem/mostvisitedpages","version":"0.0.9","description":"This package fetches and returns your most viewed pages based on Google Analytics","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","exports":{"import":"./dist/index.js","require":"./dist/index.js"},"scripts":{"test":"package-check","build":"tsc","publish":"npm run build && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/ElianVanCutsem/MostVisitedPages.git"},"bugs":{"url":"https://github.com/ElianVanCutsem/MostVisitedPages/issues"},"keywords":["Google","Analytics"],"author":{"name":"Elian Van Cutsem","email":"hello@elian.codes","url":"https://www.elian.codes"},"license":"ISC","dependencies":{"@google-analytics/data":"^2.7.0"},"devDependencies":{"@skypack/package-check":"^0.2.2","typescript":"^4.4.3"},"gitHead":"56fed925e2339e2033e9cd811922dac4b98eb2d0","homepage":"https://github.com/ElianVanCutsem/MostVisitedPages#readme","_id":"@elianvancutsem/mostvisitedpages@0.0.9","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-G4ONUgCFz2MG+4JfVGox/a3zBnD63WyQ1wAbDaZQErc1HpDLH+2vGIWF79csPWlgCl7x6pXGBtvi6CVo0bJC0Q==","shasum":"c9a3ab20f61b37429e9aa3eee7108eed7a34f14b","tarball":"https://registry.npmjs.org/@elianvancutsem/mostvisitedpages/-/mostvisitedpages-0.0.9.tgz","fileCount":10,"unpackedSize":10801,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1WkpCRA9TVsSAnZWagAAbB4QAId6HKRbYzte8hZ5VW9r\nksXylghbgjp+4nCdw7X9nDqmb8KeVnuuEOeifZKHedAD/ieMmqbjtDO57gEu\n0W0OvoYnsC1h7m7QZkVJO/6D35M+TtcEc1ijattw1VogyPGQMqhs8Av0RVqb\n61HHv3dBxBaaodhFgBEn3ahejejYVtFD9B5XS5OFUejSLejjwOqc0KBG+pen\nCMsUb4R1XxaAyYJ//hPj3Qc+O+dVl+o8Z3485uHgNE+CUtauD+BheClFdDxq\n+Ji7qT1nZ0zNrC3YXuJneK0QA79wBxEMPbKu0+5Tld1tD0kHZdDxa245DXlX\nHKD7feK0w7DLLcteRauf1s80PR815VMfiE69jEWYUaNvp8tDpaDyIUnSn3nd\nqbqKtc4OKqD+dNI7QsakwciSfbB9KgGMq35yiX5R3iudzxuxm/oX7nGP4LTm\n9hAWjatowcYTUvouqJU+S3NQWfFJxuwIyVOwA2Lx3yVGOmazTLPXqiJS7V5Z\n2pa732QzZIsu7sh2F+w/9x9wMyefJWx1UsRmpKYOF1+2ugoPOk9HQEk1vRmK\nbpqWZdrXt+URfnwO36PHX3nWesxFdnW8Jv9/f0BMvpn6+4nhokpyUqnZR5qA\nSCMITeGck+bVuLVmS5iAYNCdvdEhHzwqNrNv73KL6mk4UPBkUVHelRpMd1/C\nSf6v\r\n=rGUQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBAhEo0IkQ6jbsOuHVBSlEmUVXydDOhdndiTE6PM3Dy0AiAkNlZ3Nj2e3Ixqqz3v3euUNvPICOOElMdaduwskkuRDw=="}]},"_npmUser":{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"},"directories":{},"maintainers":[{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mostvisitedpages_0.0.9_1634071564537_0.8181024270450614"},"_hasShrinkwrap":false}},"maintainers":[{"name":"elianvancutsem","email":"elianvancutsem@gmail.com"}],"description":"This package fetches and returns your most viewed pages based on Google Analytics","homepage":"https://github.com/ElianVanCutsem/MostVisitedPages#readme","keywords":["Google","Analytics"],"repository":{"type":"git","url":"git+https://github.com/ElianVanCutsem/MostVisitedPages.git"},"author":{"name":"Elian Van Cutsem","email":"hello@elian.codes","url":"https://www.elian.codes"},"bugs":{"url":"https://github.com/ElianVanCutsem/MostVisitedPages/issues"},"license":"ISC","readme":"# MostVisitedPages\n\nPackage created to fetch your x most frequent visited pages from Google Analytics and the Google Analytics Data API.\n\nBoth TypeScript and ESModules are supported\n\n## Installation\n\n```bash\nnpm i @elianvancutsem/mostvisitedpages\n```\n\nor use a CDN like Skypack\n\n```js\nimport { MostVisitedPages } from \"https://cdn.skypack.dev/@elianvancutsem/mostvisitedpages@0.0.8\";\n```\n\n## Using `@elianvancutsem/mostvisitedpages`\n\nThe MostVisitedPages constructor takes in two required parameters: `credentials` & `propertyId` and one possible undefined parameter `options`.\n\n### `credentials`\n\nCredentials has two variables; `client_email` and `private_key`. Both of these can be created by creating a JSON Service Account.\n\nFollow [the Official Google Analytics Data API documentation](<https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries>) for more information about how to do this.\n\n### `propertyId`\n\nThe PropertyId is the PropertyID of the Google analytics property.\n\nNOTE: the Service account should be added with `read & analyze` access to the property.\n\n### `options`\n\nThe options parameter will be used for more configuration options in the future, but is only used right now to exclude certain url's from the return array.\nThe only downside to this is that if you set a limit on your request and `x` number of url's are exluded, the result will return `x`results less instead of your set `limit`\n\n### Example\n\n```js\nimport { MostVisitedPages } from \"@elianvancutsem/mostvisitedpages\";\n\nconst testEmail = \"xxx\"\nconst testKey = \"xxx\"\nconst options = {\n    exludeUrls = ['www.elian.codes/']\n}\n\nconst mostVisitedPages = new MostVisitedPages({client_email: testEmail, private_key: testKey}, 'xxxxxxxx', options)\n```\n\n## Functions\n\n### `getPageViews(limit?: number)`\n\nFunction that returns an array of the x most viewed pages in the last 90 days according to Google Analytics.\n\nThis function returns an array of the `Page` type (which can be imported from `@elianvancutsem/mostvisitedpages`)\n\nThe `limit` parameter provides a limit to the number of pages returned, will default to `10` if none is set.\n\n### `getPageViewsSince(startDate: string, limit?: number)`\n\nWorks like `getPageViews()` but with a required `startDate`.\n\nThe `startDate` parameter can be a date like `2021-10-01` (YYYY-MM-DD) or can be a sring like `NdaysAgo` or `yesterday`. It will **default to the past 90 days if none is provided**.\n\n### `getAllPageViewsSince(startDate: string)`\n\nWorks like `getPageViewsSince()` but without a limit on pages.\n\n### `getActiveUsers(limit?: number)`\n\nworks like `getPageViews()`, but returns the active users instead of the views.\n\n### `getActiveUsersSince(startDate: string, limit?: number)`\n\nworks like `getPageViewsSince()`, but returns the active users instead of the views.\n\n## Types\n\ntypes can be imported from `@elianvancutsem/mostvisitedpages` like the following:\n\n```js\nimport { Page } from '@elianvancutsem/mostvisitedpages';\n```\n\n### Options\n\n```ts\n{\n    excludeUrls?: string[]\n}\n```\n\n### Page\n\n```ts\n{\n    title: string\n    url: string\n    views?: number\n    users?: number\n}\n```\n\n### Credentials\n\n```ts\n{\n    client_email: string\n    private_key: string\n}\n```\n\n## CommonJS Support\n\nTo use this package with CommonJS, use `require(@elianvancutsem/mostvisitedpages)` instead of `import`. Below is an example\n\n```js\nconst mvp = require(\"@elianvancutsem/mostvisitedpages\");\n\nconst testEmail = \"xxx\"\nconst testKey = \"xxx\"\n\nconst mostVisitedPages = new mvp.MostVisitedPages({client_email: testEmail, private_key: testKey}, 'xxxxxxxx')\n\nconst getReport = async () => {\n    console.log(await mostVisitedPages.getPageViewsSince('yesterday', 4));\n}\n\ngetReport();\n```\n\n## Full Example\n\n```js\nimport { MostVisitedPages } from \"@elianvancutsem/mostvisitedpages\";\n\nconst testEmail = \"xxx\"\nconst testKey = \"xxx\"\n\nconst mostVisitedPages = new MostVisitedPages({client_email: testEmail, private_key: testKey}, 'xxxxxxxx')\n\nconst getReport = async () => {\n    console.log(await mostVisitedPages.getPageViewsSince('yesterday', 4));\n}\n\ngetReport();\n```\n","readmeFilename":"README.md"}