diff --git a/bedrock/firefox/tests/test_helpers.py b/bedrock/firefox/tests/test_helpers.py
index b3884706ee2..c65d7093b6c 100644
--- a/bedrock/firefox/tests/test_helpers.py
+++ b/bedrock/firefox/tests/test_helpers.py
@@ -129,7 +129,7 @@ def test_download_location_attribute(self):
for link in links:
link = pq(link)
- assert link.attr("data-download-location") == "primary cta"
+ assert link.attr("data-cta-position") == "primary cta"
doc = pq(render("{{ download_firefox() }}", {"request": get_request, "fluent_l10n": self.get_l10n(get_request.locale)}))
@@ -137,7 +137,7 @@ def test_download_location_attribute(self):
for link in links[1:5]:
link = pq(link)
- assert link.attr("data-download-location") is None
+ assert link.attr("data-cta-position") is None
def test_download_nosnippet_attribute(self):
"""
@@ -339,7 +339,7 @@ def test_download_firefox_thanks_button(self):
assert href == "/firefox/download/thanks/"
assert button.attr("id") == "download-button-thanks"
- assert link.attr("data-link-type") == "download"
+ assert link.attr("data-cta-text") == "Download Firefox"
# Direct attribute for legacy IE browsers should always be win 32bit
assert link.attr("data-direct-link") == f"{settings.BOUNCER_URL}?product=firefox-stub&os=win&lang=en-US"
@@ -368,7 +368,7 @@ def test_download_firefox_thanks_attributes(self):
assert href == "/en-US/firefox/download/thanks/"
assert button.attr("id") == "test-download"
- assert link.attr("data-download-location") == "primary cta"
+ assert link.attr("data-cta-position") == "primary cta"
assert "test-css-class" in link.attr("class")
diff --git a/bedrock/firefox/tests/test_views.py b/bedrock/firefox/tests/test_views.py
index ed55fe0af8f..031bdbcfcb0 100644
--- a/bedrock/firefox/tests/test_views.py
+++ b/bedrock/firefox/tests/test_views.py
@@ -485,17 +485,14 @@ class TestFirefoxGA(TestCase):
def assert_ga_attr(self, response):
doc = pq(response.content)
links = doc(".mzp-c-button")
+ # test buttons all have appropriate attribute to trigger tracking in GA
for link in links.items():
- cta_data = link.attr("data-cta-type")
- cta_link = link.attr("data-link-type")
- if cta_data:
- contains_cta = any(cta_data in item for item in ["link", "button"])
- assert contains_cta or "fxa-" in cta_data
- elif cta_link:
- cta_link_types = ["download", "button", "link"]
- assert cta_link in cta_link_types
+ cta_text = link.attr("data-cta-text")
+ link_text = link.attr("data-link-text")
+ if cta_text or link_text:
+ assert True
else:
- assert False, f"{link} does not contain attr cta-type or link-type"
+ assert False, f"{link} does not contain attr data-cta-text or data-link-text"
def test_firefox_home_GA(self):
req = RequestFactory().get("/en-US/firefox/")
diff --git a/bedrock/mozorg/templates/mozorg/analytics-tests/ga-index.html b/bedrock/mozorg/templates/mozorg/analytics-tests/ga-index.html
index ab36d4276de..775bfe4360a 100644
--- a/bedrock/mozorg/templates/mozorg/analytics-tests/ga-index.html
+++ b/bedrock/mozorg/templates/mozorg/analytics-tests/ga-index.html
@@ -12,8 +12,8 @@
{% block content %}
This file is used only for automated testing for google tag manager
- download firefox
- click here to test
+ download firefox
+ click here to test
fxa button
{% endblock %}
diff --git a/media/css/firefox/browsers-products.scss b/media/css/firefox/browsers-products.scss
index 8f54490c215..6c9117340a6 100644
--- a/media/css/firefox/browsers-products.scss
+++ b/media/css/firefox/browsers-products.scss
@@ -296,7 +296,7 @@ $url-download-link-hover: svg-url($download-link-hover);
}
// issue 13317
-.fx-unsupported .cta-download[data-download-os="Desktop"]{
+.fx-unsupported .cta-download[data-cta-type="firefox"]{
display: none;
}
diff --git a/media/js/base/base-page-init.js b/media/js/base/base-page-init.js
index 4388fdbf417..e119f8bed77 100644
--- a/media/js/base/base-page-init.js
+++ b/media/js/base/base-page-init.js
@@ -15,7 +15,7 @@
var utils = Mozilla.Utils;
utils.initMobileDownloadLinks();
- utils.trackDownloadThanksButton();
+ utils.attributeDownloadThanksButton();
});
}
diff --git a/media/js/base/mozilla-utils.js b/media/js/base/mozilla-utils.js
index 07135a39a69..fc19708d4c0 100644
--- a/media/js/base/mozilla-utils.js
+++ b/media/js/base/mozilla-utils.js
@@ -24,44 +24,31 @@ if (typeof window.Mozilla === 'undefined') {
};
/**
- * Get GA data attribute values for download_firefox_thanks() buttons.
+ * Get platform version for download_firefox_thanks() buttons.
* @param {Object} window.site
- * @returns {Object} os, name, version
+ * @returns {Object} version
*/
- Utils.getDownloadAttributionValues = function (site) {
+ Utils.getDownloadPlatformVersion = function (site) {
var data = {};
var platform = site.platform;
switch (platform) {
case 'windows':
- data.os = 'Desktop';
- data.name = 'Windows 32-bit';
data.version = 'win';
break;
case 'osx':
- data.os = 'Desktop';
- data.name = 'macOS';
data.version = 'osx';
break;
case 'linux':
- data.os = 'Desktop';
- data.name =
- site.archSize === 64 ? 'Linux 64-bit' : 'Linux 32-bit';
data.version = site.archSize === 64 ? 'linux64' : 'linux';
break;
case 'ios':
- data.os = 'iOS';
- data.name = 'iOS';
data.version = 'ios';
break;
case 'android':
- data.os = 'Android';
- data.name = 'Android';
data.version = 'android';
break;
default:
- data.os = 'Unsupported';
- data.name = 'Unsupported';
data.version = 'unsupported';
}
@@ -69,18 +56,16 @@ if (typeof window.Mozilla === 'undefined') {
};
/**
- * Set platfrom specific GA data attributes for download_firefox_thanks() buttons.
+ * Set stub attribution data attributes for download_firefox_thanks() buttons.
*/
- Utils.trackDownloadThanksButton = function () {
+ Utils.attributeDownloadThanksButton = function () {
var downloadButton = document.querySelectorAll(
'.c-button-download-thanks > .download-link'
);
- var data = Utils.getDownloadAttributionValues(window.site);
+ var data = Utils.getDownloadPlatformVersion(window.site);
for (var i = 0; i < downloadButton.length; ++i) {
- if (data && data.os && data.name && data.version) {
- downloadButton[i].setAttribute('data-download-os', data.os);
- downloadButton[i].setAttribute('data-display-name', data.name);
+ if (data && data.version) {
downloadButton[i].setAttribute(
'data-download-version',
data.version
diff --git a/tests/pages/firefox/family/landing.py b/tests/pages/firefox/family/landing.py
index 31f35428b28..0b4716e6e4b 100644
--- a/tests/pages/firefox/family/landing.py
+++ b/tests/pages/firefox/family/landing.py
@@ -14,9 +14,9 @@ class FamilyPage(BasePage):
_firefox_nav_cta_locator = (By.CSS_SELECTOR, ".c-navigation-shoulder")
- _firefox_nav_download_button_locator = (By.CSS_SELECTOR, "[data-download-location='nav']")
+ _firefox_nav_download_button_locator = (By.CSS_SELECTOR, "[data-cta-position='nav']")
- _firefox_desktop_download_button_locator = (By.CSS_SELECTOR, "[data-download-location='download section']")
+ _firefox_desktop_download_button_locator = (By.CSS_SELECTOR, "[data-cta-position='download section']")
_firefox_make_default_button_locator = (By.CSS_SELECTOR, "[data-cta-text='Set Firefox as your default browser']")
diff --git a/tests/unit/spec/base/mozilla-utils.js b/tests/unit/spec/base/mozilla-utils.js
index 1cb6a4c0bb1..0bebe5f03e0 100755
--- a/tests/unit/spec/base/mozilla-utils.js
+++ b/tests/unit/spec/base/mozilla-utils.js
@@ -58,15 +58,13 @@ describe('mozilla-utils.js', function () {
});
});
- describe('getDownloadAttributionValues', function () {
+ describe('getDownloadPlatformVersion', function () {
it('should return expected values for Windows', function () {
const site = {
platform: 'windows'
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'Desktop',
- name: 'Windows 32-bit',
version: 'win'
});
});
@@ -75,10 +73,8 @@ describe('mozilla-utils.js', function () {
const site = {
platform: 'osx'
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'Desktop',
- name: 'macOS',
version: 'osx'
});
});
@@ -88,10 +84,8 @@ describe('mozilla-utils.js', function () {
platform: 'linux',
archSize: 32
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'Desktop',
- name: 'Linux 32-bit',
version: 'linux'
});
});
@@ -101,10 +95,8 @@ describe('mozilla-utils.js', function () {
platform: 'linux',
archSize: 64
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'Desktop',
- name: 'Linux 64-bit',
version: 'linux64'
});
});
@@ -113,10 +105,8 @@ describe('mozilla-utils.js', function () {
const site = {
platform: 'ios'
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'iOS',
- name: 'iOS',
version: 'ios'
});
});
@@ -125,10 +115,8 @@ describe('mozilla-utils.js', function () {
const site = {
platform: 'android'
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'Android',
- name: 'Android',
version: 'android'
});
});
@@ -137,10 +125,8 @@ describe('mozilla-utils.js', function () {
const site = {
platform: 'other'
};
- const result = Mozilla.Utils.getDownloadAttributionValues(site);
+ const result = Mozilla.Utils.getDownloadPlatformVersion(site);
expect(result).toEqual({
- os: 'Unsupported',
- name: 'Unsupported',
version: 'unsupported'
});
});
diff --git a/tests/unit/spec/firefox/new/common/thanks.js b/tests/unit/spec/firefox/new/common/thanks.js
index 2083c7e8ebe..85ebb303faf 100644
--- a/tests/unit/spec/firefox/new/common/thanks.js
+++ b/tests/unit/spec/firefox/new/common/thanks.js
@@ -63,7 +63,7 @@ describe('thanks.js', function () {
Download Firefox
Download Firefox
Firefox for Android
-
Firefox for iOS
+
Firefox for iOS
`;
document.body.insertAdjacentHTML('beforeend', button);