{"id":18605887,"url":"https://github.com/axllent/silverstripe-analytics-js","last_synced_at":"2025-05-12T14:32:31.093Z","repository":{"id":13437947,"uuid":"16127057","full_name":"axllent/silverstripe-analytics-js","owner":"axllent","description":"Extension to add Google Universal Analytics (gtag.js) tracking code to Silverstripe","archived":false,"fork":false,"pushed_at":"2024-11-01T03:19:11.000Z","size":97,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T01:19:31.474Z","etag":null,"topics":["google-analytics","google-universal-analytics","gtag","php","silverstripe","universal-analytics"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/axllent.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2014-01-22T03:06:42.000Z","updated_at":"2024-11-01T03:19:08.000Z","dependencies_parsed_at":"2024-01-16T03:58:02.046Z","dependency_job_id":"1a683e43-6db2-485a-97da-120cbd54e2f8","html_url":"https://github.com/axllent/silverstripe-analytics-js","commit_stats":{"total_commits":84,"total_committers":5,"mean_commits":16.8,"dds":0.25,"last_synced_commit":"d6a19bf34a55189a7b5699015f22025952aa86fd"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axllent%2Fsilverstripe-analytics-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axllent%2Fsilverstripe-analytics-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axllent%2Fsilverstripe-analytics-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axllent%2Fsilverstripe-analytics-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axllent","download_url":"https://codeload.github.com/axllent/silverstripe-analytics-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253754966,"owners_count":21958934,"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":["google-analytics","google-universal-analytics","gtag","php","silverstripe","universal-analytics"],"created_at":"2024-11-07T02:23:26.906Z","updated_at":"2025-05-12T14:32:31.068Z","avatar_url":"https://github.com/axllent.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Universal Analytics for Silverstripe\n\n### **Please note** that the functionality provided by this module is now fairly redundant since the release of Google Analytics 4 (GA4), and is no longer in active development.\nIf you're looking for an alternative then take a look at [springtimesoft/silverstripe-tracking-scripts](https://github.com/springtimesoft/silverstripe-tracking-scripts).\n\nAn extension to add Google **Universal Analytics** `gtag()` tracking code (not to be confused with Google Tag Manager) to your Silverstripe templates.\n\nIt automatically includes optional unobtrusive **event tracking** for all outbound links \u0026 \"asset downloads\", as well as event tracking for 404 and error pages, email \u0026 telephone links.\n\n## Features\n\n- Google Universal Analytics (gtag.js) code injected automatically into `\u003chead\u003e` of page to prevent JavaScript conflicts due to loading order (if you are using custom `gtag()` functions in your other code.\n- Automatic `pageview` tracking for all configured accounts, including tracking of 404 \u0026 500 page errors (tracked as \"Page Not Found\" / \"Page Error\" events).\n- Unobtrusive outbound, download, email \u0026 tel: link tracking - monitors all page clicks, rather than on page load (ie: works with links including those generated by Ajax etc on the page after page load).\n- Uses Google Analytics `hitCallback` for tracking for outgoing links to register before load (ie: when no link `target` is set) to ensure tracker is successfully run before redirection.\n- Tracking codes are automatically changed to `UA-DEV-[1-9]` if `SS_ENVIRONMENT_TYPE` is **not** live, or if page URL matches ?flush= to prevent bad data capture.\n\n### Event tracking\n\nAdditional event tracking is automatically enabled by default for:\n\n- File downloads (all non-image files in the assets folder) are tracked as \"**Downloads**\".\n- Outgoing links are tracked as \"**Outgoing Links**\".\n- Email (`mailto:`) links are tracked as \"**Email Links**\".\n- Phone (`tel:`) links are tracked as \"**Phone Links**\".\n\nEvent category names (eg: \"Outgoing Links\", \"Downloads\" etc) can be configured in your yaml config.\n\n**Note:** Event tracking only works with regular (left-or-middle) mouse button clicks (including combinations with Ctrl/Shift/Meta keys). Tracking is bypassed if the user right-clicks on a link and selects an action from the context menu (open in new tab, save as etc...). Unfortunately there is no way around this without disabling the content menu entirely.\n\n## Requirements\n\n- Silverstripe ^4 || ^5\n\nFor the deprecated `analytics.js` tracking method for Silverstripe 4, please refer to the [analytics.js branch](https://github.com/axllent/silverstripe-analytics-js/tree/3-analyticsjs).\n\nFor Silverstripe 3, please refer to the [Silverstripe3 branch](https://github.com/axllent/silverstripe-analytics-js/tree/silverstripe3).\n\n## Installation via Composer\n\nYou can install it via composer with\n```\ncomposer require axllent/silverstripe-analytics-js\n```\n\n## Basic usage\n\nOnce installed the extension is automatically loaded if you provide at least one tracking account in your config yaml file (eg) `app/_config/analytics.yml`\n\n```yaml\nAxllent\\AnalyticsJS\\AnalyticsJS:\n  tracker:\n    - ['config', 'UA-1234567-1']\n```\n\nThe syntax is very similar to the official documentation, so things like secondary trackers or other configurations can be easily added.\n\n```yaml\nAxllent\\AnalyticsJS\\AnalyticsJS:\n  tracker:\n    - ['config', 'UA-1234567-1']          # default account [required]\n    - ['config', 'UA-1234567-2']          # add secondary tracker\n    - ['set', 'forceSSL', true]           # force tracking to use SSL\n    - ['require', 'ecommerce', 'ecommerce.js']  # load ecommerce extension\n  track_links: false                      # disable external link \u0026 asset tracking\n  ignore_link_class:  \"notrack\"           # if \"track_links\", then ignore external links with the \"notrack\" class\n  compress_js: false                      # do not compress inline JavaScript\n  primary_gtag_id: \"UA-1234567-1\"         # set the default tracking id to be used when loading gtag (defaults to the first tracker)\n```\n\nPlease refer to the [Configuration.md](docs/en/Configuration.md) for all configuration options.\n\nTo start live tracking, make sure your website is in `live` mode, or if running in `dev` or `staging` that you\nhave the `track_in_dev_mode: true` option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxllent%2Fsilverstripe-analytics-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxllent%2Fsilverstripe-analytics-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxllent%2Fsilverstripe-analytics-js/lists"}