{"id":20711822,"url":"https://github.com/helick/gtm","last_synced_at":"2026-05-08T06:02:30.474Z","repository":{"id":56983920,"uuid":"190615407","full_name":"helick/gtm","owner":"helick","description":"Plugin for Google Tag Manager integration","archived":false,"fork":false,"pushed_at":"2019-08-23T12:05:48.000Z","size":49,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T21:21:54.082Z","etag":null,"topics":["composer","wordpress","wordpress-plugin"],"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/helick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-06T16:36:11.000Z","updated_at":"2019-08-23T12:04:01.000Z","dependencies_parsed_at":"2022-08-21T09:10:51.519Z","dependency_job_id":null,"html_url":"https://github.com/helick/gtm","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helick%2Fgtm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helick%2Fgtm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helick%2Fgtm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helick%2Fgtm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helick","download_url":"https://codeload.github.com/helick/gtm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242982736,"owners_count":20216661,"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":["composer","wordpress","wordpress-plugin"],"created_at":"2024-11-17T02:17:02.768Z","updated_at":"2025-12-24T06:27:56.483Z","avatar_url":"https://github.com/helick.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Helick Google Tag Manager\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Total Downloads][ico-downloads]][link-downloads]\n[![Software License][ico-license]](LICENSE.md)\n[![Quality Score][ico-code-quality]][link-code-quality]\n\nGoogle Tag Manager integration.\n\n## Requirements\n\nMake sure all dependencies have been installed before moving on:\n\n* [PHP](http://php.net/manual/en/install.php) \u003e= 7.1\n* [Composer](https://getcomposer.org/download/)\n\n## Install\n\nInstall via Composer:\n\n``` bash\n$ composer require helick/gtm\n```\n\nUpdate your application config by declaring the following:\n\n``` php\nConfig::define('GTM_CONTAINER_ID', env('GTM_CONTAINER_ID'));\n```\n\nUpdate your env variables by declaring the following:\n\n``` dotenv\nGTM_CONTAINER_ID=GTM-XXXX\n```\n\n## Usage\n\nTo support the fallback iframe for devices without javascript add the following code just after the opening `\u003cbody\u003e` tag in your theme:\n\n``` php\n\u003c?php wp_body_open(); ?\u003e\n```\n\n### Data layer\n\nGoogle Tag Manager offers a [data layer](https://developers.google.com/tag-manager/devguide) which allows you pass arbitrary data that can be used to modify which tags are added to your site.\n\nThis plugin adds some default information such as post, tags and categories and provides a simple filter for adding in your own custom data.\n\n``` php\nadd_filter('helick_gtm_data_layer', function (array $dataLayer) {\n    $dataLayer['foo'] = 'bar';\n\n    return $dataLayer;\n});\n```\n\n### Event tracking\n\nTo deactivate the event tracking you may declare the following:\n\n``` php\nadd_filter('helick_gtm_enable_event_tracking', '__return_false');\n```\n\nBy default the event listener script will look for the elements on the page with special data attributes in your markup and listen for the specified event to push to the data layer.\n\nThe data attributes are:\n\n- `data-gtm-variable` *string* Optionally override the default data layer variable name for this event.\n- `data-gtm-on` *enum* [click|submit|keyup|focus|blur] The JS event to listen for, defaults to 'click'.\n- `data-gtm-event` *string* The event name.\n- `data-gtm-category` *string* Optional group the event belongs to.\n- `data-gtm-label` *string* Optional human readable label for the event.\n- `data-gtm-value` *number* Optional numeric value associated with the event.\n- `data-gtm-fields` *string* Optional extra data provided as encoded JSON.\n\nExample:\n\n``` html\n\u003cbutton\n    data-gtm-on=\"click\"\n    data-gtm-event=\"play\"\n    data-gtm-category=\"videos\"\n    data-gtm-label=\"Featured Promotional Video\"\n\u003e\n  Play video\n\u003c/button\u003e\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email evgenii@helick.io instead of using the issue tracker.\n\n## Credits\n\n- [Evgenii Nasyrov][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/helick/gtm.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/helick/gtm.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/helick/gtm.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/helick/gtm\n[link-code-quality]: https://scrutinizer-ci.com/g/helick/gtm\n[link-downloads]: https://packagist.org/packages/helick/gtm\n[link-author]: https://github.com/nasyrov\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelick%2Fgtm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelick%2Fgtm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelick%2Fgtm/lists"}