Sometimes you will need your donor to jump between landing pages in RaiseDonors, yet you'd like to retain the original landing page URL parameters. We've created a javascript function which you may include in your account to accomplish this.
The purpose and function of this javascript is to find any "href" on the page that has a class of "keepParameters". If an "href" has that class, then this javascript will automatically add whatever URL parameters exists in the URL to the link. The beauty in this is, it makes all of the links on the page with this class, dynamic—inheriting whatever is passed to the page. So for your marketing efforts that have custom URLs, now all of the "hrefs" on the page(s) can inherit those custom parameters.
There are two main steps for retaining URL parameters:
- Make sure you add the custom Javascript to your page or account.
- Add "keepParameters" to the class of the "href".
If there is a link you've created in the content that you do NOT want to inherit parameters from the URL, then don't add in the class "keepParameters".
<script type="text/javascript">
window.onload = function() {
const elements = document.getElementsByClassName(' keepParameters');
for (const element of elements) {
element.href += document.location.search;
element.href += '#' + element.id;
}
};
</script>
Here is an example of how you add that custom class to the "href":