putyourlightson / craft-campaign

Send and manage email campaigns, contacts and mailing lists in Craft CMS.
https://putyourlightson.com/plugins/campaign
Other
63 stars 25 forks source link

Campaign appends the `queryStringParameters` after a hash fragment in URL #383

Closed kennethormandy closed 1 year ago

kennethormandy commented 1 year ago

If you use a URL in a Campaign with that includes a hash fragment identifier, like https://example.com/blog-post#my-heading, Campaign appends the queryStringParameters at the very end. This stops the page from jumping to that ID anymore.

For example:

https://example.com/blog#my-heading

…becomes:

https://example.com/blog-post#my-heading?utm_source=campaign-plugin&utm_medium=email

…when it should probably become:

https://example.com/blog-post?utm_source=campaign-plugin&utm_medium=email#my-heading

I am guessing this is happening here: https://github.com/putyourlightson/craft-campaign/blob/6f8c4e5dd1a3ca51d8500abe8006a098c10d07c5/src/controllers/TrackerController.php#LL74C1-L75C60

I doubt you need this level of detail, but apparently this has the best sources: https://superuser.com/a/498625

Thanks!

bencroker commented 1 year ago

Thanks for reporting this, I’ll look into fixing the behaviour for the next release.

bencroker commented 1 year ago

Fixed in https://github.com/putyourlightson/craft-campaign/commit/21fb7a24eafd2ffe163f74e006a7fefde03111d4 and released in version 2.7.0.