MozillaFoundation / donate-wagtail

[Legacy] - Wagtail based donation stack
Mozilla Public License 2.0
43 stars 22 forks source link

[FRU] Add JavaScript Snippet to give.thunderbird.net #1713

Closed mtdenton closed 1 year ago

mtdenton commented 1 year ago

In order to test and utilize Fundraise Up capabilities, we'll need to add the following snippet globally into the <head> of our thunderbird pages:

<!-- 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','ADGJGYAN');</script>
<!-- End Fundraise Up -->

Our CSP directives will also have to be updated to allow these scripts to load on the page. Details can be found here

A nonce attribute will need to be added to the opening <script> in the snippet above. Example: <script nonce="{{request.csp_nonce}}"

Dev Tasks

Acceptance Criteria

mtdenton commented 1 year ago

I accidentally clicked epic and now I don't know how to fix it. It shouldn't be an epic.

danielfmiranda commented 1 year ago

Tested this on staging, looks to be working as expected to me! 👍

mtdenton commented 1 year ago

Looks good on staging here as well. Ready for prod