Skip to content

Commit

Permalink
Add education survey for Tues/Weds 9th/10th of August
Browse files Browse the repository at this point in the history
The same content as the main survey, but shown 5x more frequently on
education content.

This survey is only active when:

  * The breadcrumb contains 'Education' OR 'Schools' OR 'Childcare',
    case insensitive.
  * The `govuk:section` metatag equals "education and learning" OR
    "childcare and parenting" -- i.e. the content is given this section
    in panopticon.
  * The `govuk:analytics:organisations` tag contains one of
    `<D6>|<D106>|<D109>|<EA243>|<EA86>|<EA242>|<EA541>`, meaning the
    organisation is DfE, Ofsted, Ofqual, STA, SFA, EFA, or NCTL.
  • Loading branch information
kalleth committed Aug 1, 2016
1 parent 86915d5 commit de312ee
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app/assets/javascripts/surveys.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@
frequency: 50,
},
smallSurveys: [
{
url: 'https://www.surveymonkey.com/s/2MRDLTW',
identifier: 'user_satisfaction_survey',
template: TEMPLATE,
frequency: 10,
activeWhen: function() {
function breadcrumbMatches() {
var text = $('#global-breadcrumb').text() || "";
return (/Education/i.test(text) || /Schools/i.test(text) || /Childcare/i.test(text));
}

function sectionMatches() {
var sectionName = $('meta[name="govuk:section"]').attr('content');
return (sectionName === 'education and learning' || sectionName === 'childcare and parenting');
}

function organisationMatches() {
var orgMatchingExpr = /<D6>|<D106>|<D109>|<EA243>|<EA86>|<EA242>|<EA541>/;
var metaText = $('meta[name="govuk:analytics:organisations"]').attr('content') || "";
return orgMatchingExpr.test(metaText);
}

return (sectionMatches() || breadcrumbMatches() || organisationMatches());
},
startTime: new Date("August 9, 2016").getTime(),
endTime: new Date("August 10, 2016 23:59:59").getTime()
}
],

init: function() {
Expand Down

0 comments on commit de312ee

Please sign in to comment.