{"id":19388795,"url":"https://github.com/james2doyle/vue-ga-directive","last_synced_at":"2025-04-23T23:31:45.408Z","repository":{"id":57396038,"uuid":"47422940","full_name":"james2doyle/vue-ga-directive","owner":"james2doyle","description":"A directive for accessing the Google Analytics window.ga object by using params/attributes","archived":false,"fork":false,"pushed_at":"2015-12-09T22:01:57.000Z","size":5,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T13:06:52.855Z","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/james2doyle.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":"2015-12-04T18:53:26.000Z","updated_at":"2020-07-20T19:23:20.000Z","dependencies_parsed_at":"2022-09-18T11:00:47.248Z","dependency_job_id":null,"html_url":"https://github.com/james2doyle/vue-ga-directive","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fvue-ga-directive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fvue-ga-directive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fvue-ga-directive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fvue-ga-directive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/james2doyle","download_url":"https://codeload.github.com/james2doyle/vue-ga-directive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250532100,"owners_count":21446117,"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-10T10:13:45.319Z","updated_at":"2025-04-23T23:31:45.136Z","avatar_url":"https://github.com/james2doyle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-ga-directive\n\nA directive for accessing the Google Analytics window.ga object by using attributes.\n\n### Install\n\nAvailable through npm as `vue-ga-directive`. Or include as an inline script, like in `example.html`.\n\n### Demo\n\nYou can load up the `example.html` file here to test the directive.\n\n### Usage\n\nHere is how you might typically use this directive:\n\n```html\n\u003cbutton type=\"button\" v-ga-event:click.prevent=\"My Custom Label\" v-ga-value=\"99\" v-ga-callback=\"myVmFunction\"\u003eFire Click Event\u003c/button\u003e\n```\n\nYou can see we have `v-ga-event` which is listening for a `click` and it will also trigger `event.preventDefault()`. This is the same format as normal Vue `v-on:*` events.\n\nNext we have the `v-ga-value` property. This is a positive Int that will be passed to the event. [Read the docs for more on eventValue](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventValue).\n\nThe last item is `v-ga-callback`. This will trigger that function in your current `Vue.vm`. It is like calling `this.myVmFunction(directiveInstance, event.target)`. For example, you might want to track the event, and then when the request is done, trigger a form submit or fetch a piece of data.\n\nYou can see a `Vue` instance in `js/main.js` if you want more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fvue-ga-directive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjames2doyle%2Fvue-ga-directive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fvue-ga-directive/lists"}