{"id":13830378,"url":"https://github.com/SvenSommer/MMM-GoogleAnalytics","last_synced_at":"2025-07-09T11:33:16.623Z","repository":{"id":124004920,"uuid":"96820359","full_name":"SvenSommer/MMM-GoogleAnalytics","owner":"SvenSommer","description":"This [MagicMirror²] module allows you to display data from your Google Analytics Account.","archived":false,"fork":false,"pushed_at":"2017-11-09T18:40:07.000Z","size":17832,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-05T10:11:24.698Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SvenSommer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-10T20:53:40.000Z","updated_at":"2021-08-02T10:54:53.000Z","dependencies_parsed_at":"2024-01-15T17:49:14.588Z","dependency_job_id":null,"html_url":"https://github.com/SvenSommer/MMM-GoogleAnalytics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvenSommer%2FMMM-GoogleAnalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvenSommer%2FMMM-GoogleAnalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvenSommer%2FMMM-GoogleAnalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvenSommer%2FMMM-GoogleAnalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SvenSommer","download_url":"https://codeload.github.com/SvenSommer/MMM-GoogleAnalytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225539391,"owners_count":17485318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T10:00:59.241Z","updated_at":"2024-11-20T11:30:45.534Z","avatar_url":"https://github.com/SvenSommer.png","language":"JavaScript","funding_links":[],"categories":["Productivity"],"sub_categories":[],"readme":"# MMM-GoogleAnalytics\r\n\r\nThis is a module for the [MagicMirror²](https://github.com/MichMich/MagicMirror/) to display data from Google Analytics.\r\n\r\n![Screenshot of a MMM-GoogleAnalytics](http://robstechlog.com/wp-content/uploads/2017/07/MMM-Googleanalytics_feature.png?raw=true)\r\n\r\n\u003cbr\u003e\r\n\r\nAn optional broadcast of visitors/customers location data to [MMM-Globe](https://github.com/SvenSommer/MMM-Globe) is also possible.\u003cp\u003e\r\n\r\n![Screenshot of a MMM-GoogleAnalytics](https://github.com/SvenSommer/MMM-GoogleAnalytics/blob/master/MMM-GoogleAnalytics_animated.gif?raw=true)\r\n##### Important note to MMM-Globe\r\nUnfortunately MMM-Globe is not capable of running properly on a Raspberry Pi 3 causes of lacking computing power.\r\n\r\nOr with the words of the creator of MMM-Globe: \"Due to the intensive calculations needed to construct the objects, and the computational ability needed, I do not recommend using this module if your Mirror uses a Raspberry Pi. Please only use this module if you have something a little more powerful driving your mirror. I don’t want my work to be responsible for any mishaps with your devices.\"\r\n\r\n## Using the module\r\n### 1. Install the module\r\n\r\nIn your terminal, go to your MagicMirror's Module folder:\r\n````\r\ncd ~/MagicMirror/modules\r\n````\r\n\r\nClone this repository:\r\n````\r\ngit clone https://github.com/SvenSommer/MMM-GoogleAnalytics\r\n````\r\n\r\n### 2. Install Googles Analytics Core Reporting API and node-geocoder library\r\nInstall the Googles Analytics Core Reporting API for Node.js in your ``MMM-GoogleAnalytics`` folder by using npm:\r\n\r\n```\r\ncd MMM-GoogleAnalytics\r\nnpm install --save googleapis\r\nnpm install node-geocoder\r\n```\r\n### 3. Get the credentials from Google\r\nTo get the credentials from Google, following this [blogpost](http://robstechlog.com/2017/07/19/display-website-statistics-smart-mirror-mmm-googleanalytics/).\r\n\r\nAfter you have done this, you should be able to:\r\n* Copy your ``viewID``. You'll need it in the next step.\r\n* Rename your credential file (e.g. ``mywebsiteGAapi-6116b1dg49a1.json``) in ``keyfile.json`` and save it in your ``MMM-GoogleAnalytics`` folder, like ``MMM-GoogleAnalytics/keyfile.json``. If you haven't done already.\r\n\r\n### 4. Configure the module in your `config.js` file.\r\nTo use this module, add the following configuration block to the modules array in the `config/config.js` file:\r\n```js\r\nvar config = {\r\n    modules: [\r\n        {\r\n        module: 'MMM-GoogleAnalytics',\r\n        header: 'mywebsite.com - Today',\r\n        position: 'top_left',\r\n        config: {\r\n            viewID : 'ga:123456700', // see README.md, how to get viewID and your keyfile.json\r\n            start_date: 'today', //today,1daysAgo,\r\n            end_date: 'today',\r\n            metrics: 'ga:newusers, ga:users, ga:sessions, ga:pageviews,  ga:sessionDuration',\r\n\t\t\tdimensions: 'ga:country', //ga:country, ga:city,ga:source\r\n\t\t\tsort: '-ga:timeOnPage',\r\n\t\t\tfilters: 'ga:timeOnPage\u003e10', //ga:timeOnPage\u003e10 Return results where the time on the page is strictly greater than ten seconds.\r\n\t\t\tsegment: '',\r\n\t\t\tstart_index: 1,\r\n\t\t\tmax_results: 50,\r\n\t\t\tupdateInterval: 1 * 10 * 1000, // every minute\r\n\t\t\tshowtable: true,\r\n            showtotalline: true,\r\n\t\t\texportdatatoMMM_Globe: false,\r\n\t\t\tdebug: false\r\n            }\r\n        },\r\n    ]\r\n}\r\n```\r\n### 5. (Optional) Configure the module to broadcast to MMM-Globe\r\nIf you want to display the geographic  location of your website visitors on the [MMM-Globe](https://github.com/SvenSommer/MMM-Globe) module, follow the following steps:\r\n* The Query needs to include ``'ga:city, ga:country'`` for the dimensions. In this specific order.\r\n* Follow the install instructions of [MMM-Globe](https://github.com/SvenSommer/MMM-Globe)\r\n* within the ``config section`` of MMM-Globe, change ``receiveExternalLocations:`` to ``1``.\r\n\r\n## Configuration options\r\nCheck out the [common queries](https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries) in the [API Reference](https://developers.google.com/analytics/devguides/reporting/core/v3/reference).\r\n\r\nThe [Query Explorer](https://ga-dev-tools.appspot.com/query-explorer/) lets you play with the API by building queries. Very useful!\r\n\r\n| Option           | Required | Type | Description\r\n|----------------- |-----------|-------|----------------\r\n| `viewID`        | *yes*|`string`| Google Analytics view (profile) ID. Follow this [blogpost](http://robstechlog.com/2017/07/19/display-website-statistics-smart-mirror-mmm-googleanalytics/) to get it.\r\n| `start_date`        | *yes*|`string`| Start date for fetching Analytics data.\r\n| `end_date`        | *yes*|`string`| End date for fetching Analytics data.\r\n| `metrics`        | *yes*|`string`| The aggregated statistics for user activity to your site, such as clicks or pageviews. See [Possible Options](https://developers.google.com/analytics/devguides/reporting/core/dimsmets).\r\n| `dimensions`        | *no*|`string`| Breaks down metrics by common criteria.\r\n| `sort`        | *no*|`string`| A list of metrics and dimensions indicating the sorting order and sorting direction for the returned data.\r\n| `filters`        | *no*|`string`| restricts the data returned from your request.\r\n| `max_results`        | *no*|`int`| The maximum number of rows to include in the response.\r\n| `showtable` | *no*|`bool`| `true` - shows results in a table. `false` - no table is shown\r\n| `showtotalline` | *no*|`bool`| `true` - shows a sum in the end of each column. `false` - no summary on each column\r\n| `exportdatatoMMM_Globe` | *no*|`bool`| `true` - Modul sends coordinates of users to another module called [MMM-Globe](https://github.com/SvenSommer/MMM-Globe). Therefore you need to include ``ga:city, ga:country`` in dimension section of your query.\r\n| `debug` | *no*|`bool`| `true` - shows debug information. `false` - no debug info is shown\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSvenSommer%2FMMM-GoogleAnalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSvenSommer%2FMMM-GoogleAnalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSvenSommer%2FMMM-GoogleAnalytics/lists"}