-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
(dev/mail#81) Flexmailer - Track click-throughs for URLs with tokens #19386
Conversation
In the prior commit, it needed to conceptually change the behavior of `getTrackerURL($oldURL): $trackedURL`, but it danced around it (adding more classes and similar-sounding-methods, but distributed elsewhere). This re-consolidates to keep a cleaner separation of responsibilities between `{Html,Text}ClickTracker.php` (*parsing an HTML or text message for URLS*) and `TrackableURL.php` (*translating the URL*).
(Standard links)
|
@totten @artfulrobot please merge when you are happy with this |
I've filled in the description. Since @artfulrobot gave supportive comments in the other issue discussion, and since there's a lot of relevant test-coverage, I'm flagging 'merge ready'. |
@totten I've not (@eileenmcnaughton I don't have merge powers) |
Merging based on @artfulrobot @totten comments |
Just for the record: Documentation PR at https://lab.civicrm.org/documentation/docs/user-en/-/merge_requests/469 |
See https://lab.civicrm.org/dev/core/-/issues/2511 for possible related regression |
Overview
When delivering a mail-blast, Flexmailer replaces most URLs with trackable URLs. This expands tracking support for URLs that include tokens.
This is a rebased+modified version of @artfulrobot's #19136 (also civicrm/org.civicrm.flexmailer#46) which simplifies the class design. It addresses https://lab.civicrm.org/dev/mail/-/issues/81
Before
Suppose you send a mailing with content like this:
The first link (which is a simple/static URL) will be replaced with tracking details (ie
http://example.org/
<=>u=9000
). In the second link, the tokens ({contact.id}
) are replaced, but the tracking code is not provided.After
Both links have a tracking code.
For the second link, note that the URL parameters are split in two parts, the static and dynamic parts. The static part is stored in the tracking record (ie
http://example.org/civicrm/profile/edit?gid=100
<=>u=9001
), and it will appear in the reporting. The dynamic part is appended (and does not appear in the reporting).This relies on an existing behavior where the
civicrm/mailing/url
end-point will relay unrecognized parameters (e.g&id
and&cs
; perCRM_Mailing_Page_Url::extractPassthroughParameters()
).Comments
The older BAO mailer still behaves as before. This patch only impacts Flexmailer, which is (a) used for Mosaico and (b) optionally used for traditional CiviMail (depending on options in "Administer => CiviMail => Flexmailer").
To see that this impacts Flexmailer and not BAO mailer, consider the mailng-system-tests (
CRM_Mailing_MailingSystemTest
andCivi\FlexMailer\FlexMailerSystemTest
which extendBaseMailingSystemTest
). The tests include a scenario for URLs with tokens. The scenario remains unchanged forCRM_Mailing_MailingSystemTest
; but forFlexMailerSystemTest
, the scenario had to be changed.(Note: I took a quick look at updating BAO mailer+test, but the underlying codepaths in the BAO side are fairly different and it didn't seem worth the effort.)