{"id":22923858,"url":"https://github.com/xruff/googleanalytics","last_synced_at":"2026-05-01T14:33:45.363Z","repository":{"id":57084986,"uuid":"89641145","full_name":"XRuff/GoogleAnalytics","owner":"XRuff","description":"Google Analytics component for Nette","archived":false,"fork":false,"pushed_at":"2023-01-13T11:19:44.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T09:29:02.805Z","etag":null,"topics":["google-analytics","nette","nette-component"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XRuff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-27T21:17:05.000Z","updated_at":"2020-04-19T21:34:38.000Z","dependencies_parsed_at":"2023-02-09T15:20:13.079Z","dependency_job_id":null,"html_url":"https://github.com/XRuff/GoogleAnalytics","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRuff%2FGoogleAnalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRuff%2FGoogleAnalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRuff%2FGoogleAnalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRuff%2FGoogleAnalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XRuff","download_url":"https://codeload.github.com/XRuff/GoogleAnalytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246659637,"owners_count":20813331,"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","nette","nette-component"],"created_at":"2024-12-14T08:17:37.063Z","updated_at":"2026-05-01T14:33:45.312Z","avatar_url":"https://github.com/XRuff.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Google Analytics component for Nette Framework application\n======\n\nRequirements\n------------\n\nPackage requires PHP 5.6 or higher\n\n- [nette/security](https://github.com/nette/security)\n- [nette/application](https://github.com/nette/application)\n\nInstallation\n------------\n\nThe best way to install XRuff/GoogleAnalytics is using  [Composer](http://getcomposer.org/):\n\n```sh\n$ composer require xruff/googleanalytics\n```\n\nDocumentation\n------------\n\nConfiguration in config.neon. Both parameters are optional.\n\nIf parameter `code` is missing, GA code will not be rendered in template. If parameter `user` is missing, default settings will be used - value `on`. If paramter `user` is `on` and user is logged in, google analytics code will contain directive `ga('set', 'userId', {$user-\u003eid});`\n\n```yml\nextensions:\n    googleAnalytics: XRuff\\App\\UI\\Components\\DI\\GoogleAnalyticsExtension\n\ngoogleAnalytics:\n    code: UA-123456789-1\n    user: on # on/off - display user ID if user is logged in\n```\n\nBase presenter:\n\n```php\nuse XRuff\\App\\UI\\Components\\IGoogleAnalyticsControlFactory;\n\nabstract class BasePresenter extends Nette\\Application\\UI\\Presenter\n{\n\t/** @var IGoogleAnalyticsControlFactory $googleAnalyticsControlFactory @inject */\n\tpublic $googleAnalyticsControlFactory;\n\n\tprotected function createComponentGoogleAnalytics()\n\t{\n\t\treturn $this-\u003egoogleAnalyticsControlFactory-\u003ecreate();\n\t}\n}\n```\n\n@layout.latte:\n\n```smarty\n    ...\n\u003c/head\u003e\n\u003cbody\u003e\n    {control googleAnalytics}\n    ...\n```\n\nYou can invoke parameters into control in latte template. 1st parameter is GA code. 2nd parameter should be boolean and manage displaying GA directive for user's session - `ga('set', 'userId', {$user-\u003eid});`. Both parameters are optioanl.\n\n```smarty\n    ...\n\u003c/head\u003e\n\u003cbody\u003e\n    {control googleAnalytics 'UA-123456789-2', false}\n    ...\n```\n\n-----\n\nRepository [https://github.com/XRuff/GoogleAnalytics](https://github.com/XRuff/GoogleAnalytics).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxruff%2Fgoogleanalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxruff%2Fgoogleanalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxruff%2Fgoogleanalytics/lists"}