Social Share buttons: add UTM campaign codes to shared URLs #8727
+10
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds UTM campaign code query string parameters to URLs shared by social share button links. These parameters follow CFPB guidelines for such campaign codes.
Additions
facebook_campaign etc: URL encoded query strings for URLs shared via Facebook, X, LinkedIn, and email.
note: A value for linkedin_campaign is included here so that the proper query string values are documented, in case LinkedIn restores support for such query strings in shared URLs.
Removals
Changes
added the new query string parameter strings to the share_url values for each social share button
note: linkedin_campaign is added to the LinkedIn share_url string, even though it doesn't appear to be supported currently - just in case support for such query strings returns. It does no harm, but rather is simply ignored.
How to test this PR
Go to a page on CF.gov that includes share buttons; these include blog or newsroom posts and some language or report pages.
Click on the Facebook, X (Twitter), and Email share buttons, and confirm that the proper campaign code query strings are added to the links shared via each of these methods.
Note: If you're testing using localhost:8000, Facebook share won't work, because this platform apparently checks to make sure that the URL you are sharing is reachable.
Click on the LinkedIn share button and make sure that it still works, provides the same share dialog as the live site.
Screenshots
Notes and todos
Checklist
Browser testing
Check the current browser support cutoff list](https://cfpb.github.io/consumerfinance.gov/browser-support#current-browser-support-metrics) for browsers that are advisable
to prioritize for testing.
Accessibility
Other