diff --git a/app/assets/javascripts/surveys.js b/app/assets/javascripts/surveys.js index 380db5996..ec9ad7368 100644 --- a/app/assets/javascripts/surveys.js +++ b/app/assets/javascripts/surveys.js @@ -23,18 +23,31 @@ }, smallSurveys: [ { - url: 'https://www.surveymonkey.co.uk/r/GZ2JDHZ', - identifier: 'three_word_survey', - template: '
' + - '
' + - '

How do you feel about your visit to GOV.UK today?

' + - '

No thanks

' + - '

Take the 1 question survey This will open a short survey on another website

' + - '
' + - '
', - startTime: new Date("September 7, 2016").getTime(), - endTime: new Date("September 8, 2016 23:59:59").getTime(), - frequency: 50 + url: 'https://www.surveymonkey.co.uk/r/73CQFCB', + identifier: 'international_content_survey', + template: TEMPLATE, + frequency: 10, + activeWhen: function() { + function sectionMatches() { + var sectionName = $('meta[name="govuk:section"]').attr('content'); + return (sectionName === 'visas and immigration' || sectionName === 'passports, travel and living abroad'); + } + + function pathMatches() { + var pathMatchingExpr = /\/foreign-travel-advice|\/government\/world/; + return pathMatchingExpr.test(userSurveys.currentPath()); + } + + function organisationMatches() { + var orgMatchingExpr = /|||/; + var metaText = $('meta[name="govuk:analytics:organisations"]').attr('content') || ""; + return orgMatchingExpr.test(metaText); + } + + return (sectionMatches() || pathMatches() || organisationMatches()); + }, + startTime: new Date("October 25, 2016").getTime(), + endTime: new Date("October 28, 2016 23:59:59").getTime() } ],