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

Embed a FundraiseUp (FRU) modal directly on mozilla.org. #14575

Open
4 tasks
enavajas opened this issue May 15, 2024 · 2 comments
Open
4 tasks

Embed a FundraiseUp (FRU) modal directly on mozilla.org. #14575

enavajas opened this issue May 15, 2024 · 2 comments
Assignees

Comments

@enavajas
Copy link
Collaborator

Hello. We recieved a request to embed a FundraiseUp (FRU) modal directly on mozilla.org. Below are the steps I received:

  • Step 1 - Update CSP Policy:

To ensure that FundraiseUp elements can render correctly on the site, please update your Content Security Policy with the directives described in the FundraiseUp documentation.

  • Step 2 - Add FundraiseUp Installation Script:

Add the Mozilla Foundation's FundraiseUp Installation Code to your website by placing the following JavaScript snippet within the global section of your HTML, ideally as the last script.

To confirm installation, inspect the area of your website’s source code; the installation code should be present.

<!-- Fundraise Up: the new standard for online giving -->
<script>
(function(w,d,s,n,a){
  if(!w[n]){
    var l='call,catch,on,once,set,then,track'.split(','),
        i,o=function(n){return 'function'==typeof n?o.l.push([arguments])&&o
          :function(){return o.l.push([n,arguments])&&o}},t=d.getElementsByTagName(s)[0],
        j=d.createElement(s);j.async=!0;j.src='https://cdn.fundraiseup.com/widget/'+a;
        t.parentNode.insertBefore(j,t);o.s=Date.now();o.v=4;o.h=w.location.href;o.l=[];
    for(i=0;i<7;i++)o[l[i]]=o(l[i]);
    w[n]=o
  }
})(window,document,'script','FundraiseUp','ADCYPWMX');
</script>
<!-- End Fundraise Up -->
  • Step 3: Link to Campaign Forms

To display a FundraiseUp campaign's checkout modal when a user clicks a link:

  1. Access the desired campaign's page on the FundraiseUp dashboard and note the query parameter in the URL found in the “Checkout Modal” section. In this example, the parameter is “?form=donate”

Screenshot 2024-05-05 at 20-25-38 Fundraise Up

  1. Append the query string "?form=donate" to the href attribute of the desired link/button https://mozilla.org/?form=featured-section

  2. Now when the user clicks on the link, the checkout modal will appear:

Screenshot 2024-05-05 at 9 17 24 PM
  • Step 4: Make a Test Donation

To test the functionality, add "&fundraiseupLivemode=no" to the URL after the checkout modal is triggered and refresh the page. This allows you to make test donations without processing actual funds, as test card details will be provided to you once the checkout process begins.

Screenshot 2024-05-05 at 8 49 36 PM
@craigcook craigcook self-assigned this May 15, 2024
craigcook added a commit that referenced this issue May 15, 2024
@craigcook
Copy link
Member

https://www-demo9.allizom.org/?form=donate

Collecting a few thoughts after an initial pass, in no particular order:

  1. The FundraiseUp docs on CSP recommend giving pretty broad permissions to several entire domains, so we may need to consider the security implications of that. Perhaps we can tighten it up without breaking the widget (e.g. do we actually need to allow all of *.paypal.com or are there specific subdomains we can limit it to? Do we really need to allow fonts from those domains or can we use system fonts or our own webfonts? How much control of the widget styling do we get?).

  2. This is a pure JavaScript widget and of course fails completely if JavaScript is disabled or there's an error of any kind. We also need to consider that it may become nonfunctional with various adblockers or tracking protections blocking any of the (MANY) scripts being injected.

  3. We'll need to write some functional tests.

  4. If this widget is global (i.e. can appear on any page if you load that page with the ?form=foo query string) does that mean all our current donate links will become non-links and just invoke the widget instead of going somewhere? href="#?form=foo?

  5. I think we'll still need an actual www.mozilla.org/donate/ page that people can link to.

  6. I'm not sure how l10n works for the widget. They do support lots of languages, but they don't seem to detect language automatically. Seems like we may have to configure it per URL? https://fundraiseup.com/docs/localization-settings/

  7. This adds about 400k of third-party JavaScript to the pageload (EVERY pageload if we embed it globally) and that's before the widget appears. Once it's invoked (which, when it's triggered by a query param, means it's triggered on pageload) it injects another 5MB(!!) of third-party JS. We can try to mitigate that and only load scripts when actually called for, but the basic implementation isn't very performant.

@alexgibson
Copy link
Member

alexgibson commented May 16, 2024

We also need to get confirmation from legal that the MoFo implementation of this form is OK to load in EU/EAA countries without a cookie banner, or if a banner is required. FundraiseUp have a doc here that lists their essential/non-essential cookies, but I'm not clear if our config is already restricting cookies to only those that are essential. We need to confirm with MoFo/legal teams before this goes live.

craigcook added a commit that referenced this issue May 16, 2024
craigcook added a commit that referenced this issue May 28, 2024
craigcook added a commit that referenced this issue May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants