Exports a de-duplicated list of donor data for sending bulk emails. The name reflects our current provider, but the logic is generic.
We export two files - one with donor data (email, name, language, geographical region, and contribution statistics), and one with email addresses to unsubscribe.
We group contacts by email address and use the donor information associated with the latest donation for each email. We aggregate the number of donations, the total amount given, the latest donation, and the largest donation in USD and original currency.
We unsubscribe an email address if any of the contacts associated with it are marked 'opt out', 'do not email', or 'do not solicit', or if the email has been marked 'on hold' (as is done by CiviCRM's bounce detection). We also unsubscribe any email addresses which are only associated with deleted contacts, or only exist as non-primary addresses. Work is in progress to use the CiviCRM change log to unsubscribe old emails when addresses are edited.
Landing page impression counter
Tallies hits to landing pages at wikimediafoundation.org and donate.wikimedia.org. Runs as a Django management task for some reason. [Operational details] are documented on wikitech.
It filters server logs and only considers a request to be a landing page hit if it matches certain patterns. In the table below, patterns are listed as prefixes of any wiki page title. For example, the Support_Wikipedia pattern would include https://wikimediafoundation.org/wiki/Support_Wikipedia_in_2016.
|Wiki||Included patterns||Ignored patterns|
Special:FundraiserLandingPage on donatewiki is treated as a special case. For this special page, the 'landingpage' value is a tilde-separated list of these querystring parameters: "template", "appeal-template", "appeal", "form-template", and "form-countryspecific".
All landing page hits are added to the landingpageimpressions_raw table, including timestamp, utm_source, utm_campaign, utm_key, utm_medium, landingpage, project_id, language_id, and country_id.
Email click counts
Hits to donatewiki landing pages that include a contact_id parameter are also added to the donatewiki_unique table with timestamp, utm_source, utm_campaign, contact_id, and link_id. Each combination of utm_source and contact_id can only occur once in this table, so it should be an accurate count of the number of unique donors clicking some link in each email. These are aggregated in view donatewiki_counts by utm_source, utm_campaign, and link_id.