From ce5cb80bce78391248c4cf4f8fbeb244b5fd5781 Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:49:41 -0300 Subject: [PATCH 1/7] VPN page PPA experiment --- .../products/templates/products/vpn/base.html | 1 + .../products/vpn/landing-refresh.html | 4 ++++ media/js/products/vpn/ppa-experiment.js | 23 +++++++++++++++++++ media/static-bundles.json | 6 +++++ 4 files changed, 34 insertions(+) create mode 100644 media/js/products/vpn/ppa-experiment.js diff --git a/bedrock/products/templates/products/vpn/base.html b/bedrock/products/templates/products/vpn/base.html index 411544e8e69..7e48d85d702 100644 --- a/bedrock/products/templates/products/vpn/base.html +++ b/bedrock/products/templates/products/vpn/base.html @@ -12,6 +12,7 @@ {% block page_favicon %}{{ static('img/favicons/vpn/favicon.ico') }}{% endblock %} {% block page_favicon_large %}{{ static('img/favicons/vpn/favicon.png') }}{% endblock %} {% block page_ios_icon %}{{ static('img/favicons/vpn/favicon.png') }}{% endblock %} +{% block extra_meta %}{% endblock %} {% block sub_navigation %} {% include 'products/vpn/includes/subnav-refresh.html' %} diff --git a/bedrock/products/templates/products/vpn/landing-refresh.html b/bedrock/products/templates/products/vpn/landing-refresh.html index 5a5d3c1b366..8e28eb74c6a 100644 --- a/bedrock/products/templates/products/vpn/landing-refresh.html +++ b/bedrock/products/templates/products/vpn/landing-refresh.html @@ -8,6 +8,7 @@ {% from "products/vpn/includes/macros.html" import vpn_nav_cta_refresh, vpn_conditional_cta_refresh with context %} {% extends "products/vpn/base.html" %} +{% block extra_meta %}{% endblock %} {# Issue 13019: Avoid duplicate content for English pages. #} {%- block page_title_full -%} @@ -407,4 +408,7 @@

{% endif %} {{ js_bundle('data_begincheckout') }} + {% if LANG == "en-CA" %} + {{ js_bundle('mozilla-vpn-ppa-experiment') }} + {% endif %} {% endblock %} diff --git a/media/js/products/vpn/ppa-experiment.js b/media/js/products/vpn/ppa-experiment.js new file mode 100644 index 00000000000..5c0531f909e --- /dev/null +++ b/media/js/products/vpn/ppa-experiment.js @@ -0,0 +1,23 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +if (/\sFirefox/.test(navigator.userAgent)) { + const links = document.getElementsByClassName('js-fxa-product-button'); + Array.from(links).forEach(link => { + "use strict"; + + link.addEventListener('click', () => { + navigator.privateAttribution.measureConversion({ + task: "task_id", // Unique task ID. Supplied by Mozilla. + histogramSize: 5, // Supplied by Mozilla + lookbackDays: 7, // Number of days to look back for attribution + impression: "click", // Attribution model to use + ads: ["ad_id"], // List Ad IDs. Supplied by Mozilla. + sources: ["mozilla.org"] // List of publisher domains + }); + }); + }); +} diff --git a/media/static-bundles.json b/media/static-bundles.json index 8474f025f7d..300c2210185 100644 --- a/media/static-bundles.json +++ b/media/static-bundles.json @@ -1744,6 +1744,12 @@ ], "name": "mozilla-vpn-landing-headlines-experiment" }, + { + "files": [ + "js/products/vpn/ppa-experiment.js" + ], + "name": "mozilla-vpn-ppa-experiment" + }, { "files": [ "js/products/shared/affiliate-init.es6.js" From 45279846f77c93dc4a5a22725ed3c2675c6fb302 Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:01:05 -0300 Subject: [PATCH 2/7] update LANG requirement --- bedrock/products/templates/products/vpn/landing-refresh.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bedrock/products/templates/products/vpn/landing-refresh.html b/bedrock/products/templates/products/vpn/landing-refresh.html index 8e28eb74c6a..fcdbea68f26 100644 --- a/bedrock/products/templates/products/vpn/landing-refresh.html +++ b/bedrock/products/templates/products/vpn/landing-refresh.html @@ -408,7 +408,7 @@

{% endif %} {{ js_bundle('data_begincheckout') }} - {% if LANG == "en-CA" %} + {% if LANG == "en-US" %} {{ js_bundle('mozilla-vpn-ppa-experiment') }} {% endif %} {% endblock %} From c4dfca42da79d9b1395633b80bea1d03b1b714df Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Thu, 18 Jul 2024 09:42:56 -0300 Subject: [PATCH 3/7] update ad ID --- media/js/products/vpn/ppa-experiment.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/media/js/products/vpn/ppa-experiment.js b/media/js/products/vpn/ppa-experiment.js index 5c0531f909e..252caff7eae 100644 --- a/media/js/products/vpn/ppa-experiment.js +++ b/media/js/products/vpn/ppa-experiment.js @@ -11,12 +11,12 @@ if (/\sFirefox/.test(navigator.userAgent)) { link.addEventListener('click', () => { navigator.privateAttribution.measureConversion({ - task: "task_id", // Unique task ID. Supplied by Mozilla. - histogramSize: 5, // Supplied by Mozilla - lookbackDays: 7, // Number of days to look back for attribution - impression: "click", // Attribution model to use - ads: ["ad_id"], // List Ad IDs. Supplied by Mozilla. - sources: ["mozilla.org"] // List of publisher domains + task: "task_id", // Unique task ID. Supplied by Mozilla. + histogramSize: 5, // Supplied by Mozilla + lookbackDays: 7, // Number of days to look back for attribution + impression: "click", + ads: ["moz-mdn-test-2"], + sources: ["mozilla.org"] }); }); }); From 96e0930c081b1bb55522c8ff494e54bc85cd5b40 Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:45:30 -0300 Subject: [PATCH 4/7] add country code --- bedrock/products/templates/products/vpn/landing-refresh.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bedrock/products/templates/products/vpn/landing-refresh.html b/bedrock/products/templates/products/vpn/landing-refresh.html index fcdbea68f26..d7e6a5feae7 100644 --- a/bedrock/products/templates/products/vpn/landing-refresh.html +++ b/bedrock/products/templates/products/vpn/landing-refresh.html @@ -408,7 +408,7 @@

{% endif %} {{ js_bundle('data_begincheckout') }} - {% if LANG == "en-US" %} + {% if LANG == "en-US" and country_code == 'US' %} {{ js_bundle('mozilla-vpn-ppa-experiment') }} {% endif %} {% endblock %} From b02abd1bdd1bbd880ef1a75216a7569cc081bfe6 Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:50:03 -0300 Subject: [PATCH 5/7] format update --- media/js/products/vpn/ppa-experiment.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/media/js/products/vpn/ppa-experiment.js b/media/js/products/vpn/ppa-experiment.js index 252caff7eae..7c41d3685ee 100644 --- a/media/js/products/vpn/ppa-experiment.js +++ b/media/js/products/vpn/ppa-experiment.js @@ -6,17 +6,17 @@ if (/\sFirefox/.test(navigator.userAgent)) { const links = document.getElementsByClassName('js-fxa-product-button'); - Array.from(links).forEach(link => { - "use strict"; + Array.from(links).forEach((link) => { + 'use strict'; link.addEventListener('click', () => { navigator.privateAttribution.measureConversion({ - task: "task_id", // Unique task ID. Supplied by Mozilla. + task: 'task_id', // Unique task ID. Supplied by Mozilla. histogramSize: 5, // Supplied by Mozilla lookbackDays: 7, // Number of days to look back for attribution - impression: "click", - ads: ["moz-mdn-test-2"], - sources: ["mozilla.org"] + impression: 'click', + ads: ['moz-mdn-test-2'], + sources: ['mozilla.org'] }); }); }); From 14ae11770ac781874f9b6eddff1497ec261cc386 Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:09:44 -0300 Subject: [PATCH 6/7] update token value and lookbackDays --- bedrock/products/templates/products/vpn/landing-refresh.html | 4 +++- media/js/products/vpn/ppa-experiment.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bedrock/products/templates/products/vpn/landing-refresh.html b/bedrock/products/templates/products/vpn/landing-refresh.html index d7e6a5feae7..f7d1e10247a 100644 --- a/bedrock/products/templates/products/vpn/landing-refresh.html +++ b/bedrock/products/templates/products/vpn/landing-refresh.html @@ -8,7 +8,9 @@ {% from "products/vpn/includes/macros.html" import vpn_nav_cta_refresh, vpn_conditional_cta_refresh with context %} {% extends "products/vpn/base.html" %} -{% block extra_meta %}{% endblock %} +{% block extra_meta %} + +{% endblock %} {# Issue 13019: Avoid duplicate content for English pages. #} {%- block page_title_full -%} diff --git a/media/js/products/vpn/ppa-experiment.js b/media/js/products/vpn/ppa-experiment.js index 7c41d3685ee..2287539b3ca 100644 --- a/media/js/products/vpn/ppa-experiment.js +++ b/media/js/products/vpn/ppa-experiment.js @@ -13,7 +13,7 @@ if (/\sFirefox/.test(navigator.userAgent)) { navigator.privateAttribution.measureConversion({ task: 'task_id', // Unique task ID. Supplied by Mozilla. histogramSize: 5, // Supplied by Mozilla - lookbackDays: 7, // Number of days to look back for attribution + lookbackDays: 30, impression: 'click', ads: ['moz-mdn-test-2'], sources: ['mozilla.org'] From dcf1ba1203765a32a7270c0ec619fb418771304d Mon Sep 17 00:00:00 2001 From: wen-2018 <42974891+wen-2018@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:56:55 -0300 Subject: [PATCH 7/7] use switch to avoid full deployment after experiment is over --- bedrock/products/templates/products/vpn/landing-refresh.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bedrock/products/templates/products/vpn/landing-refresh.html b/bedrock/products/templates/products/vpn/landing-refresh.html index f7d1e10247a..94eed8cd262 100644 --- a/bedrock/products/templates/products/vpn/landing-refresh.html +++ b/bedrock/products/templates/products/vpn/landing-refresh.html @@ -65,6 +65,8 @@ {% set headline_exp_v3_sub = 'Protect your digital activity and physical location with just one click.' %} {% endif %} +{% set show_vpn_ppa_exp = switch('experiment-vpn-ppa', ['en-US']) and country_code == "US" %} + {% block content %}
{% call split( @@ -410,7 +412,7 @@

{% endif %} {{ js_bundle('data_begincheckout') }} - {% if LANG == "en-US" and country_code == 'US' %} + {% if show_vpn_ppa_exp %} {{ js_bundle('mozilla-vpn-ppa-experiment') }} {% endif %} {% endblock %}