Firefox Accounts Referrals

Marketing pages often promote the creation of a Firefox Account (FxA) as a common call to action (CTA). This is typically accomplished using either a signup form, or a prominent link/button. Other products such as Mozilla VPN use similar Firefox Account auth flows to manage subscriptions. To accomplish these tasks, bedrock templates can take advantage of a series of Python helpers which can be used to standardize product referrals, and make supporting these auth flows easier.


The helpers below can typically be shown to all browsers, but some also feature logic specific to desktop Firefox, such as signing users into Sync.

Firefox Account Signup Form

Use the fxa_email_form macro to display a Firefox Account signup form on a page.


To use the form in a Jinja template, first import the fxa_email_form macro:

{% from "macros.html" import fxa_email_form with context %}

The form can then be invoked using:

{{ fxa_email_form(entrypoint='') }}

The macro’s respective JavaScript and CSS dependencies should also be imported in the page:


import FxaForm from './path/to/fxa-form.es6.js';


The above JS is also available as a pre-compiled bundle, which can be included directly in a template:

{{ js_bundle('fxa_form') }}


@import '../path/to/fxa-form';

The JavaScript files will automatically handle things such as adding metrics parameters for Firefox desktop browsers. The CSS file contains some default styling for the signup form.


The signup form macro accepts the following parameters (* indicates a required parameter)

Parameter name





Unambiguous identifier for which page of the site is the referrer.



Used to identify experiments.

Experiment ID



Used to track page variations in multivariate tests. Usually just a number or letter but could be a short keyword.

Variant identifier



An optional parameter used to invoke an alternatively styled page at




Applies a CSS class name to the form. Defaults to: ‘fxa-email-form’




The main heading to be used in the form (optional with no default).

Localizable string

‘Join Firefox’ .


Introductory copy to be used in the form. Defaults to a well localized string.

Localizable string

‘Enter your email address to get started.’ .


Button copy to be used in the form. Defaults to a well localized string.

Localizable string

‘Sign Up’ .


CSS class names to be applied to the submit button.

String of one or more CSS class names

‘mzp-c-button mzp-t-primary mzp-t-product’


Used to identify specific marketing campaigns. Defaults to fxa-embedded-form

Campaign name prepended to default value



Used for paid search keywords.

Brief keyword



Declared when more than one piece of content (on a page or at a URL) links to the same place, to distinguish between them.

Description of content, or name of experiment treatment


Invoking the macro will automatically include a set of default UTM parameters as hidden form input fields:

  • utm_source is automatically assigned the value of the entrypoint parameter.

  • utm_campaign is automatically set as the value of fxa-embedded-form. This can be prefixed with a custom value by passing a utm_campaign value to the macro. For example, utm_campaign='trailhead' would result in a value of trailhead-fxa-embedded-form.

  • utm_medium is automatically set as the value of referral.

Common FxA Parameters

The fxa_button, pocket_fxa_button, and monitor_fxa_button helpers all support the same standard parameters:

Parameter name





Unambiguous identifier for which page of the site is the referrer. This also serves as a value for ‘utm_source’.




The button copy to be used in the call to action.

Localizable string

‘Try Pocket Now’


A class name to be applied to the link (typically for styling with CSS).

String of one or more class names



A boolean value that dictates if the CTA should be styled as a button or a link. Defaults to ‘True’.


True or False


A boolean value that dictates if metrics parameters should be added to the button href. Defaults to ‘True’.


True or False


An dictionary of key value pairs containing additional parameters to append the the href.


{‘s’: ‘ffpocket’}


An dictionary of key value pairs containing additional data attributes to include in the button.


{‘data-cta-text’: ‘Try Pocket Now’, ‘data-cta-type’: ‘activate pocket’,’data-cta-position’: ‘primary’}


The fxa_button helper also supports an additional action parameter, which accepts the values signup, signin, and email for configuring the type of authentication flow.

Tracking External Referrers

If the URL of a bedrock page contains existing UTM parameters on page load, bedrock will attempt to automatically use those values to replace the inline UTM parameters in Firefox Account and Mozilla VPN links. This is handled using a client side script in the site common bundle which can be found in /media/js/base/fxa-utm-referral.js.

The behavior is as follows:

  • UTM paramters will only be replaced if the page URL contains both a valid utm_source and utm_campaign parameter. All other UTM parameters are considered optional, but will still be passed as long as the required parameters exist.

  • If the above criteria is satisfied, then UTM parameters on FxA links will be replaced in their entirety with the UTM parameters from the page URL. This is to avoid mixing referral data from different campaigns.


Links generated by the FxA button helpers will automatically be covered by this script. For links generated using the fxa_link_fragment helper, you will need to manually add a CSS class of js-fxa-cta-link to trigger the behavior.

URL Parameter Conventions

When choosing URL parameter values, the following conventions help to support uniformity in code and predictability in retroactive analysis.

  • Use lower case characters in parameter values.

  • Separate words in parameter values with hyphens.

  • Follow parameter naming patterns established in previous iterations of a page.

Firefox Sync and UITour

Since Firefox 80 the FxA link and email form macros use UITour to show the Firefox Accounts page and log the browser into Sync or an Account. For non-Firefox browsers or if UITour is not available, the flow uses normal links that allow users to log into FxA as a website only without connecting the Firefox Desktop client. This UITour flow allows the Firefox browser to determine the correct FxA server and authentication flow (this includes handling the China Repack build of Firefox). This transition was introduced to later migrate Firefox Desktop to an OAuth based client authentication flow.

The script that handles this logic is /media/js/base/fxa-link.js, and will automatically apply to any link with a js-fxa-cta-link class name. The current code automatically detects if you are in the supported browser for this flow and updates links to drive them through the UITour API. The UITour showFirefoxAccounts action supports flow id parameters, UTM parameters and the email data field.

Testing Signup Flows

Testing the Firefox Account signup flows on a non-production environment requires some additional configuration.

Configuring bedrock:

Set the following in your local .env file:


For Mozilla VPN links you can also set:



The above values for staging are already set by default when Dev=True, which will also apply to demo servers. You may only need to configure your .env file if you wish to change a setting to something else.

Google Analytics Guidelines

For GTM datalayer attribute values in FxA links, please use the analytics documentation.