{"id":19514874,"url":"https://github.com/ndp/save-the-campaign","last_synced_at":"2026-06-13T08:32:44.829Z","repository":{"id":66258010,"uuid":"11889881","full_name":"ndp/save-the-campaign","owner":"ndp","description":"Patches Rails's `redirect` method to preserve marketing parameters (`utm_source`, etc.) through redirects, eliminating the need to put the code in numerous controllers.","archived":false,"fork":false,"pushed_at":"2013-08-05T04:14:03.000Z","size":120,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-08T03:55:28.736Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/ndp.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":"2013-08-05T04:01:11.000Z","updated_at":"2023-04-18T17:24:27.000Z","dependencies_parsed_at":"2023-02-20T00:55:35.844Z","dependency_job_id":null,"html_url":"https://github.com/ndp/save-the-campaign","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ndp/save-the-campaign","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fsave-the-campaign","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fsave-the-campaign/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fsave-the-campaign/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fsave-the-campaign/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndp","download_url":"https://codeload.github.com/ndp/save-the-campaign/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fsave-the-campaign/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34278153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10T23:37:54.583Z","updated_at":"2026-06-13T08:32:44.814Z","avatar_url":"https://github.com/ndp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Patches Rails's `redirect` method to preserve marketing parameters (`utm_source`, etc.)\nthrough redirects, eliminating the need to put the code in numerous controllers.\n\nNote: this deals with unfortunate situations where the redirects are unavoidable.\nIn general you should *rework inbound campaign links to avoid redirects.*\nThis gem provides a nice safety net.\n\n## Usage\n\n    # in Gemfile\n    gem 'save-the-campaign'\n\nThe gem will automatically patch ApplicationController so that the redirects are\ninstrumented properly.\n\n### Configuration\n\nBy default, the gem forwards the following parameters:\n  * `utm_campaign`\n  * `utm_medium`\n  * `utm_source`\n  * `utm_term`\n  * `utm_name`\n  * `utm_content`\n  * `utm_keyword`\n  * `gclid`\n\nTo forward other parameters, modify `SaveTheCampaign.configuration` using an initializer:\n\n    # in initializers/save_the_campaign.rb*\n    SaveTheCampaign.configure do |config|\n      config.params \u003c\u003c 'email'\n    end\n\nTo only include the patch in specified controllers, you'll need to:\n\n  1. use `gem 'save-the-campaign', require: false` in the `Gemfile`\n  2. create an `initializers/save_the_campaign.rb` and configure `auto_install = false`\n  3. explicitly include `SaveTheCampaign::ControllerMixin` in any controllers that need\n     the behavior\n\n### Use Case\n\nIf a marketing campaign drops a user on a page that redirects elsewhere,\nwe want to preserve the `utm_` parameters passed in. An important case\nis when a marketing campaign sends users to a page behind login when the\nuser is not logged in. This is rare in the wild, but we have re-engagement\ncampaigns that can do this.\n\nIn addition, we have lots of redirects built into the legacy site, so as\nwe re-work our URL scheme, it's possible users will be redirected somewhere\nelse, depending on their state.\n\n\n### How it Works\n\nThe essence of this functionality to patch `_compute_redirect_to_location`.\nThe patch is found in `lib/save_the_campaign/installer.rb`.\n\n\n### References\n\n   * http://www.e-nor.com/blog/web-analytics/no-data-from-one-or-more-sources-in-your-analytics-reports\n   * https://support.google.com/analytics/answer/1033867?hl=en\n\n\n### Author\n\n   * Andrew Peterson, [http://ndpsoftware.com], [andy@stitchfix.com], or [andy@ndpsoftware.com]\n\n\n## Contributing \u0026 Bug Reports\n\nUse Github Issues and Pull Requests","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndp%2Fsave-the-campaign","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndp%2Fsave-the-campaign","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndp%2Fsave-the-campaign/lists"}