Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ads team ppa testing (fix #14839) #14850

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bedrock/products/templates/products/vpn/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +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 %}
<meta http-equiv="origin-trial" content="A19xS8UA1d0lgoVKEygJldabL1yWUWRfHJdPeWhwJbQ0bTZochXMxxWna+SNCTBFkgEVqOmbkEwnqleV8XVMftUAAABXeyJvcmlnaW4iOiJodHRwczovL3d3dy5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb24iLCJleHBpcnkiOjE3NTI3MDMyMDB9">
{% endblock %}

{# Issue 13019: Avoid duplicate content for English pages. #}
{%- block page_title_full -%}
Expand Down Expand Up @@ -407,4 +410,7 @@ <h3 class="c-learn-more-heading">
{% endif %}

{{ js_bundle('data_begincheckout') }}
{% if LANG == "en-US" and country_code == 'US' %}
wen-2018 marked this conversation as resolved.
Show resolved Hide resolved
{{ js_bundle('mozilla-vpn-ppa-experiment') }}
{% endif %}
{% endblock %}
23 changes: 23 additions & 0 deletions media/js/products/vpn/ppa-experiment.js
Original file line number Diff line number Diff line change
@@ -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({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this throw an error in older Firefox versions? It might be worth wrapping in a try/catch if so?

task: 'task_id', // Unique task ID. Supplied by Mozilla.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been provided yet? I assume our unique task ID is not actually task_id.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both task and histogramSize have not been provided yet. I will update the PR once they are available

histogramSize: 5, // Supplied by Mozilla
lookbackDays: 30,
impression: 'click',
ads: ['moz-mdn-test-2'],
sources: ['mozilla.org']
});
});
});
}
6 changes: 6 additions & 0 deletions media/static-bundles.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down