{"id":19054350,"url":"https://github.com/ecedi/utmze","last_synced_at":"2025-04-24T03:14:42.140Z","repository":{"id":84437281,"uuid":"25025612","full_name":"ecedi/utmze","owner":"ecedi","description":"A source and campaign tracking alternative to Google Analytics UTMZ cookie","archived":false,"fork":false,"pushed_at":"2014-12-05T12:33:29.000Z","size":192,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"devel","last_synced_at":"2025-04-24T03:14:34.443Z","etag":null,"topics":["campaign-tracking","ecedi","google-analytics","javascript","stick","utm-campaign","utmz-cookie"],"latest_commit_sha":null,"homepage":"https://www.ecedi.fr","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/ecedi.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":"2014-10-10T07:44:32.000Z","updated_at":"2020-01-19T21:20:58.000Z","dependencies_parsed_at":"2023-02-25T23:00:48.783Z","dependency_job_id":null,"html_url":"https://github.com/ecedi/utmze","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecedi%2Futmze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecedi%2Futmze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecedi%2Futmze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecedi%2Futmze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecedi","download_url":"https://codeload.github.com/ecedi/utmze/tar.gz/refs/heads/devel","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250552077,"owners_count":21449165,"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":["campaign-tracking","ecedi","google-analytics","javascript","stick","utm-campaign","utmz-cookie"],"created_at":"2024-11-08T23:37:58.041Z","updated_at":"2025-04-24T03:14:42.119Z","avatar_url":"https://github.com/ecedi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ecedi/utmze by [Agence Ecedi](http://ecedi.fr)\n\nThis is an alternative solution for tracking campaign as __utmz cookie is no more available with Google Analytics Universal\n\n## installation\n\n### edit your composer.json file and add\n\n```json\n\t{\n\t\t\"require\": {\n\t\t\t\"ecedi/utmze\": \"dev-master\",\n\t\t},\n\t\t\"repositories\": [\n\t\t\t{\n\t\t\t\t\"type\": \"vcs\",\n\t\t\t\t\"url\": \"https://github.com/ecedi/utmze\"\n\t\t\t}\n\t\t]\n\t}\n```\n\n## features\n\nthis script will emulate __utmz cookie behavior to track traffic source, campaign and medium (other data are not supported so far)\n\n### campaign behavior\n\ncampaign aka utmccn is false by default, when a GET parameter utm_campaign is set, it will be stored and stick until another utm_campaign is found\n\n### medium behavior\n\nmedium aka utmcmd is false by default, when a GET parameter utm_medium is set, it will be stored and stick until another utm_campaign is found\n\n### source behavior\n\nSource aka utmcsr is a little bit more tricky:\nit is (direct) by default,when a GET parameter utm_source is set, it will be stored and stick until another utm_source is found\n\n## Usage\n\n### javascript side\n\nin header\n```javascript\n\u003chead\u003e\n\t\u003cscript src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"/jquery-utmz.min.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\nbefore ``\u003c/body\u003e``\n\n```javascript\n\u003cscript type=\"text/javascript\"\u003e\n    $(document).ready(function() {\n        $().utmz();\n    }\n\u003c/script\u003e\n```\n\n### PHP side\n\nIf you want to parse the cookie in PHP, use any standard code you already use. \n\nHere are some classic code to look at\n  * [Google Analytics PHP cookie parse](http://joaocorreia.pt/google-analytics-scripts/google-analytics-php-cookie-parser/)\n  * [Code Example: Google Utmz Cookie Parser](http://daleconboy.com/portfolio/code/google-utmz-cookie-parser)\n  * [Campaign Tracking - Web Tracking (ga.js)](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCampaigns?hl=fr)\n\nThe cookie match the __utmz spec\n\n## options\n\n###  domainName (default: auto)\n\nin auto mode jquery-utmz will try to write on all sub domains\n\nIf website domain is client.inte.paris.ecedi.fr jquery-utmz will try to write (in this order)\n\t* .ecedi.fr\n\t* .paris.ecedi.fr\n\t* .inte.paris.ecedi.fr\n\t* .client.inte.paris.ecedi.fr\n\n### cookiePath (default: /)\n\nspecify the cookie path \n\n### expires (default: 61)\n\ndefine the max age of the utmz cookie, 2 month by default (61 days)\n\n```javascript\n\u003cscript type=\"text/javascript\"\u003e\n    $(document).ready(function() {\n        $().utmz({ expires: 7});\n    }\n\u003c/script\u003e\n```\n\n### cookieName (default: __utmze)\n\ndefine the cookie name, __utmze by default to not overlap with any old Google Analytics __utmz cookie\n\nIf you know what you are doing you can override to use the __utmz name\n\n```javascript\n\u003cscript type=\"text/javascript\"\u003e\n    $(document).ready(function() {\n        $().utmz({ cookieName: '__utmz'});\n    }\n\u003c/script\u003e\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecedi%2Futmze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecedi%2Futmze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecedi%2Futmze/lists"}