{"id":19112717,"url":"https://github.com/russellsteadman/affiliate","last_synced_at":"2025-08-19T14:32:38.612Z","repository":{"id":42777517,"uuid":"115934267","full_name":"russellsteadman/affiliate","owner":"russellsteadman","description":"Add affiliation tags to links automatically in the browser","archived":false,"fork":false,"pushed_at":"2023-03-15T09:49:37.000Z","size":1866,"stargazers_count":109,"open_issues_count":3,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-17T03:36:54.969Z","etag":null,"topics":["ads","advertising","affiliate","affiliate-links","affiliates","amazon","dom","javascript","link","marketing","referral"],"latest_commit_sha":null,"homepage":"https://affiliate.js.org/","language":"TypeScript","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/russellsteadman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-01-01T17:26:48.000Z","updated_at":"2024-10-10T11:32:35.000Z","dependencies_parsed_at":"2023-07-12T15:15:50.778Z","dependency_job_id":null,"html_url":"https://github.com/russellsteadman/affiliate","commit_stats":{"total_commits":85,"total_committers":4,"mean_commits":21.25,"dds":0.2823529411764706,"last_synced_commit":"3360e0b7262eca1635ba3cd7b048a0cec371a0a2"},"previous_names":["teamtofu/affiliate"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Faffiliate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Faffiliate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Faffiliate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Faffiliate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/russellsteadman","download_url":"https://codeload.github.com/russellsteadman/affiliate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230359935,"owners_count":18214157,"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":["ads","advertising","affiliate","affiliate-links","affiliates","amazon","dom","javascript","link","marketing","referral"],"created_at":"2024-11-09T04:33:55.485Z","updated_at":"2024-12-19T01:07:01.586Z","avatar_url":"https://github.com/russellsteadman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Affiliate\n\nAffiliate is a platform agnostic link affiliator. Simplify affiliating links with automatic affiliation in the browser. Affiliate works with libraries that mutate the DOM after the page loads, including React.\n\n[![🌟 Star me on Github](https://badgen.net/github/stars/russellsteadman/affiliate)](https://github.com/russellsteadman/affiliate) [![Download via NPM](https://badgen.net/npm/dt/affiliate)](https://www.npmjs.com/package/affiliate) [![Use via CDN](https://badgen.net/jsdelivr/hits/npm/affiliate)](https://www.jsdelivr.com/package/npm/affiliate) [![Bundle small when minified](https://badgen.net/bundlephobia/min/affiliate)](https://bundlephobia.com/result?p=affiliate) [![Bundle small when minified and gunzipped](https://badgen.net/bundlephobia/minzip/affiliate)](https://bundlephobia.com/result?p=affiliate)\n\n## Installation\n\nUse NPM or Yarn\n\n```bash\n$ npm install affiliate\n$ yarn add affiliate\n```\n\nOr use a CDN ([check out the codeless setup](#blogs-and-related-sites))\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/affiliate@5/dist/web/affiliate.web.js\"\u003e\u003c/script\u003e\n```\n\nThe precompiled version of `affiliate@5` supports modern browsers (i.e. `ES2016` or above) by default.\n\n## What It Can Do\n\nAffiliate can modify query tags (e.g. setting `?tag=my-tag`, which is the most common method for affiliate tags), modify URL paths, and modify host names.\n\n```html\n\u003ca href=\"https://example.com/shop/product/item-id\"\u003eOriginal\u003c/a\u003e\n```\n\n```html\n\u003ca href=\"https://example.com/shop/product/item-id?ref=my-tag\"\u003eNew Query Tags\u003c/a\u003e\n\u003ca href=\"https://example.com/shop/product/item-id/ref/my-tag\"\n  \u003eModified URL Path\u003c/a\n\u003e\n\u003ca href=\"https://my-tag.example.com/shop/product/item-id\"\u003eModified Host Name\u003c/a\u003e\n```\n\nAffiliate has easy [plugins](https://affiliate.js.org/plugins), including one for [Amazon](https://affiliate.js.org/plugins/amazon), which simplify adding affiliate links even more.\n\n## Basic Setup\n\nRead **[the documentation](https://affiliate.js.org/)** for more advanced usage.\n\n```js\nimport Affiliate from 'affiliate';\n\nconst aff = Affiliate.create({\n  tags: [\n    {\n      hosts: ['example.com', 'www.example.com'],\n      query: {\n        ref: 'my-tag', // This means ?ref=my-tag\n      },\n    },\n    {\n      hosts: ['example.org', 'shop.example.org'],\n      query: {\n        tag: 'my-tag2', // This means ?tag=my-tag2\n      },\n    },\n  ],\n});\n\naff.attach();\n```\n\n## Documentation\n\nAffiliate is simple and quick to set up, even for more complex usage. Read the docs at: **[affiliate.js.org](https://affiliate.js.org/)**.\n\n## Blogs and Related Sites\n\nA simplified codeless solution might better suit some sites that use content module systems, such as WordPress, SquareSpace, etc.\n\nInsert this code within the HTML `\u003chead\u003e...\u003c/head\u003e` tag. The contents of the `data-auto-affiliate` attribute will tell Affiliate what to do.\n\n```html\n\u003cscript\n  data-auto-affiliate=\"WHERE amazon.com, www.amazon.com SET tag = MY-AMAZON-TAG\"\n  src=\"https://cdn.jsdelivr.net/npm/affiliate@5/dist/web/affiliate.web.js\"\n  async\n  id=\"aff-js\"\n\u003e\u003c/script\u003e\n```\n\n### data-auto-affiliate Syntax\n\nThe syntax for data-auto-affiliate is capital `WHERE`, a comma separated list of domains, capital `SET`, and then comma separated list of URL queries in the format `key=value`. Multiple website groups can be separated by a capital `AND`.\n\n```sql\nWHERE amazon.com, www.amazon.com SET tag = MY-AMAZON-TAG AND WHERE example.com, shop.example.com SET ref = MY-OTHER-TAG\n```\n\n## Left with Questions?\n\nIf for any reason you feel that this documentation is unclear or incomplete, [add an issue](https://github.com/russellsteadman/affiliate/issues/new) detailing what needs to be improved.\n\n## Star This Project\n\nLike this project? Let me know by [putting a star on it](https://github.com/russellsteadman/affiliate). \u0026#x1f609;\u0026#x1f31f;\n\n## License\n\nMIT (C) [Russell Steadman](https://www.russellsteadman.com/?utm_source=aff_repo\u0026utm_medium=readme_copy). Learn more in the [LICENSE](https://github.com/russellsteadman/affiliate/blob/main/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellsteadman%2Faffiliate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frussellsteadman%2Faffiliate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellsteadman%2Faffiliate/lists"}