Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracking): support UTM coming from the ESP #1388

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

miguelpeixe
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

1200550061930446-as-1206176822900759

Supersedes #1381.

The ESP may add UTM parameters to the URL. When combined with the click-tracking functionality that will be added to the proxied URL and ignored because it's not in the destination URL. This PR allows UTM parameters to be passed along to the destination URL, so this:

https://example.com/?np_newsletters_click=1&id=123&url=https%3A%2F%2Fexample.com%3Futm_medium%3Demail&em=*|EMAIL|*&utm_campaign=test_campaign

Gets redirected to this:

https://example.com/?utm_medium=email&utm_campaign=test_campaign

There may be a case to pass along any added query parameter not part of the click-tracking configuration (np_newsletters_click, id, url, em), but I believe that requires further discussion.

How to test the changes in this Pull Request:

  1. Draft a new newsletter, add some links, and save the draft
  2. Click to preview the HTML and copy the URL of a link
  3. Append the following to the end of the URL: &utm_medium=email&utm_campaign=Newspack-Campaign-2023&utm_term=0_-0000000-%5BLIST_EMAIL_ID%5D&arbitrary_param=test-value
  4. Paste it in the browser and confirm the final URL includes the added UTM parameters

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described, only non-UTM params get stripped.

@github-actions github-actions bot added [Status] Approved Ready to merge and removed [Status] Needs Review labels Jan 5, 2024
@miguelpeixe miguelpeixe merged commit 77d3a1e into master Jan 8, 2024
7 checks passed
@miguelpeixe miguelpeixe deleted the feat/tracking-support-esp-utm branch January 8, 2024 12:32
matticbot pushed a commit that referenced this pull request Jan 11, 2024
# [2.9.0-alpha.1](v2.8.0...v2.9.0-alpha.1) (2024-01-11)

### Bug Fixes

* memberships & "other" ESP ([6e0402c](6e0402c))
* prevent the use of `add_contact` for data sync purposes ([#1386](#1386)) ([2d68c1f](2d68c1f))
* **renderer:** ensure group blocks use conditional tags ([#1380](#1380)) ([a1a9722](a1a9722))
* store and recover lists on membership reactivation ([#1377](#1377)) ([aa8a8f4](aa8a8f4))

### Features

* display warning if custom fields meta box is visible ([d595ed4](d595ed4))
* **tracking:** support UTM coming from the ESP ([#1388](#1388)) ([77d3a1e](77d3a1e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.9.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jan 25, 2024
# [2.9.0](v2.8.3...v2.9.0) (2024-01-25)

### Bug Fixes

* add lodash as dependency for editor.js ([c01aebb](c01aebb))
* memberships & "other" ESP ([6e0402c](6e0402c))
* prevent the use of `add_contact` for data sync purposes ([#1386](#1386)) ([2d68c1f](2d68c1f))
* **renderer:** ensure group blocks use conditional tags ([#1380](#1380)) ([a1a9722](a1a9722))
* store and recover lists on membership reactivation ([#1377](#1377)) ([aa8a8f4](aa8a8f4))

### Features

* display warning if custom fields meta box is visible ([d595ed4](d595ed4))
* **tracking:** support UTM coming from the ESP ([#1388](#1388)) ([77d3a1e](77d3a1e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment