{"id":21525798,"url":"https://github.com/bkwld/data-layer-events","last_synced_at":"2025-06-17T03:04:45.831Z","repository":{"id":57224526,"uuid":"66116924","full_name":"BKWLD/data-layer-events","owner":"BKWLD","description":"Push clean events onto Google Tag Manager's dataLayer","archived":false,"fork":false,"pushed_at":"2017-10-25T20:01:33.000Z","size":7,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-12T21:56:42.569Z","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/BKWLD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-19T22:51:45.000Z","updated_at":"2023-03-21T18:33:15.000Z","dependencies_parsed_at":"2022-09-04T07:01:27.861Z","dependency_job_id":null,"html_url":"https://github.com/BKWLD/data-layer-events","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BKWLD/data-layer-events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fdata-layer-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fdata-layer-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fdata-layer-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fdata-layer-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BKWLD","download_url":"https://codeload.github.com/BKWLD/data-layer-events/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fdata-layer-events/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260281569,"owners_count":22985627,"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-11-24T01:38:30.955Z","updated_at":"2025-06-17T03:04:45.801Z","avatar_url":"https://github.com/BKWLD.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# data-layer-events\n\nThis package pushes [Google Analytics type events](https://developers.google.com/analytics/devguides/collection/analyticsjs/events) onto [Google Tag Manager's dataLayer variable](https://developers.google.com/tag-manager/devguide#datalayer).  It cleans up after each push by `null`-ing keys that aren't used and supports `nonInteraction` events.\n\n## Setup\n\nSetup Google Tag Manager Variables for:\n\n- `genericCategory`\n- `genericAction`\n- `genericLabel`\n- `genericValue`\n- `genericNonInteraction`\n\nFor example:\n\n![Variable configuration for category](https://user-images.githubusercontent.com/2195815/31870598-76725210-b7fa-11e7-999d-e1e48a12c5f6.png)\n\n![Variable configuration for action](https://user-images.githubusercontent.com/2195815/31870578-5aca8244-b7fa-11e7-86d2-29d011643295.png)\n\nThen create a Trigger for `genericEvent`.  Like this:\n\n![Trigger configuration example](https://user-images.githubusercontent.com/2195815/31870614-8fb5b0e6-b7fa-11e7-83ea-1968ffc7328c.png)\n\nFinally create Tag that combines all of these.  Like this:\n\n![Tag configuration example](https://user-images.githubusercontent.com/2195815/31870519-2c0fd5e4-b7fa-11e7-8531-0fcd726c5532.png)\n\n\n## Usage\n\n```js\ndataLayer = require('data-layer-events');\n\n// Fire a normal, interaction event\ndataLayer.event('Category', 'Action', 'Label', 'Value');\n\n// Fire a non-interaction event\ndataLayer.nonInteractionEvent('Category', 'Action', 'Label', 'Value');\n```\n\nA React Component example:\n\n![A React Component example](https://user-images.githubusercontent.com/2195815/31870518-2bbde11c-b7fa-11e7-9d88-f5f19d961e92.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fdata-layer-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkwld%2Fdata-layer-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fdata-layer-events/lists"}