{"id":24423175,"url":"https://github.com/webability-go/analytics","last_synced_at":"2025-03-13T14:24:33.746Z","repository":{"id":57626761,"uuid":"179709799","full_name":"webability-go/analytics","owner":"webability-go","description":"A very simple analytics library to send events to google analytics from go","archived":false,"fork":false,"pushed_at":"2020-04-12T18:57:45.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T10:17:01.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/webability-go.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":"2019-04-05T15:39:25.000Z","updated_at":"2023-09-21T17:14:16.000Z","dependencies_parsed_at":"2022-08-31T11:03:37.051Z","dependency_job_id":null,"html_url":"https://github.com/webability-go/analytics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webability-go%2Fanalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webability-go%2Fanalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webability-go%2Fanalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webability-go%2Fanalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webability-go","download_url":"https://codeload.github.com/webability-go/analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243420568,"owners_count":20288112,"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":"2025-01-20T10:17:02.738Z","updated_at":"2025-03-13T14:24:33.725Z","avatar_url":"https://github.com/webability-go.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"@UTF-8\n\n# A very simple library to send events to your google analytics for GO\n\nAnalytics v0.1\n=============================\n\nThe library creates an object used to send simple events to a google analytics property\n\nFirst start:\n\nEnter in your go environment and install the needed libraries:\n\n```\ngo get github.com/webability-go/analytics\n```\n\nIn your code, creates the object and then use it:\n\n```\npackage main\n\nimport \"github.com/webability-go/analytics\"\n\nvar UA *analytics.UA\n\nfunction main() {\n  \n  UA = analytics.CreateUA(\"[Your Universal Analytics ID]\")\n  \n  // do something...\n\n  // Creates a UUID if we need one\n  UUID := analytics.UUID()\n  UA.SetUUID(UUID)\n  \n  // sets geo (optional, recommended), generally based on the IP of the visitor\n  UA.SetGeoID(\"JP\")   // japan\n  \n  // When you need to fire an event:\n  UA.Event(\"event-category\", \"event-action\", \"event-label\", \u003cevent-value\u003e)\n  \n  // do something... \n}\n```\n\nThe user UUID is the unique session identifier. It should be always the same UUID for the same user. The function analytics.UUID() builds one if you need one.\nIf your code attends more than one user (web server or so), be sure to keep the UUID in a cookie or database session table, or so.\nIf your code does not attend users or session, but processes, you may use a UUID per process or even one single hardcoded UUID. \nGoogle uses the UUID to count unique sessions/users in analytics.\n\nNotes on GEOID, added 2019-05-08:\n-----------------------\nThe geoid is the ISO country 2 letters or city (see google manuals). It is set once and used when sendint the events data to google.\n\nNotes on Multithreading:\n-----------------------\nIf you use the analytics on a multithread server (web server for instance), every hit implies a DIFFERENT set of basic data (UUID, GeoID, etc)\nso it is highly recommended to create the UA object in EACH THREAD instead of a one global, since every thread will send a differend UUID and GeoID.\n\n\n\n\nTO DO:\n======\n- Support more parameters to send to analytics\n\n\nVersion Changes Control\n=======================\n\nV0.2.0 - 2019-05-08\n-----------------------\n- Added support for geoid parameter\n- UUID set once only as geoid parameter\n- Event funcion does not have anymore the UUID parameter\n- Added basic test unit\n\nV0.0.1 - 2019-04-05\n-----------------------\n- Creates a session and Fires a single analytics event to google\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebability-go%2Fanalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebability-go%2Fanalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebability-go%2Fanalytics/lists"}