## Marketing guidelines
Following our [Affirm CA 2022 Brand Guidelines for Merchants](🔗) will ensure that your messaging and communications are compliant and maintain the quality of the Affirm brand. These guides include:
Branding specifications (logo size, color).
Homepage messaging guidelines (layout and approved messaging).
Product, category, cart, and payment page messaging guidelines.
Educational modals overview (referred to as Learn More modals in the guidelines document).
Email marketing guidelines (layout and approved messaging).
Social media marketing guidelines.
All of your Affirm related marketing content must be available to **all** of your customers.
## Quickstart
Monthly payment messaging and educational modals show customers how they can use Affirm to finance their purchases. Our promotional messaging allows you to:
Dynamically display monthly payment pricing information.
Offer Prequalification.
This guide will review Affirm promotional messaging and break down how to add it to your site. Once you have determined where you would like the Affirm pay-over-time-messaging to appear on your website, there are three steps to render and ensure it works correctly.
## 1. Add Affirm.js
Our global integration features extended parameters to reach international customers, which consists of an exposed `locale
` and `country-code
` field in the Affirm config.
### Including the Affirm.js script
Add the `Affirm.js
` embed code to the head of your global page template if you have not already done so. This will communicate with Affirm to help calculate the “**Starting at $x/mo**” messaging based on the financing offerings on your website.
### Locale
The `locale
` parameter allows Affirm to identify which locale you are serving your site in for any particular user. For example, let's say that you are rendering your site in Canadian French; perhaps this occurred because the user's browser setting detected Canadian French. You can provide Affirm with the user's language setting by passing it in the `locale
` parameter. Affirm will then read the locale and translate the pages accordingly, thus, matching the language the user had seen on your site. However, we will not attempt to read the user's locale directly.
### Country_code
The `country_code
` parameter represents the country of legal incorporation of your store, which is shown to any given user. So, if you are showing your Canadian website/store to a user and you have a legal presence in Canada, you would pass CAN into the `country_code
` parameter. This allows us to determine which regulations to abide by and which banks to partner with for this transaction.
Additionally, Affirm expects an “Alpha 3” [three-letter country code](🔗) for this parameter. If nothing is sent, Affirm will assume "USA".
### Supported values
Affirm supports the following combinations for these arguments:
`country_code
`:`USA
`
`locale
`:`en_US
`
`country_code
`:`CAN
`
`locale
`:`en_CA
`
`locale
`:`fr_CA
`
The following will occur when a `locale
` and/or `country_code
` is not provided:
When a `
locale
` is _not _ provided, the `locale
` will default to `en_US
` (English speaking US).When a `
country_code
` is _not_ provided, the `country_code
` will default to `USA
`.
## 2. Create promotional messaging components
Add the affirm-as-low-as HTML element where you want to display an Affirm promotional messaging component. This will render the “Starting at $x/mo” messaging on the webpage. The element attributes such as data-page-type determine which component displays. We generally recommend adding promotional messaging to your category, product, cart, and payment pages. See our [HTML Reference](🔗) for more information when creating marketing elements.

## 3. Add code to handle price changes
The price displayed on your product or cart pages may change due to product variants, quantity changes, etc. If your Affirm promotional messaging displays before the price update, the messaging will be inaccurate. To keep messaging updated, implement this refresh function into your price change callback function:
**Page reload**
If the product’s price or the Affirm promotional messaging displays after the page loads, or if you included the above refresh function statically on the page, wrap it in the `affirm.ui.ready()
` callback function. Doing so ensures that the page does not call the refresh function before `Affirm.js
` initializes.
**Price update**
When the price updates on your page, call the refresh function in the same callback function that handles your price change event. Add element IDs to promotional messaging components for easy access and modification of their attributes. Note that we use example ID names below.
**Detect modal close**
When an education modal is closed (non-prequal), you can detect that event by using the following code:
The above script did not work for my merchant.
The same code, but replacing 'learnMore' with 'prequal', as shown below, did work.
## Examples
See the following examples for how to add promotional messaging components to your site:
**To add monthly payment messaging and a product modal to your product page:**
Be sure to use your page's price variable or price amount in USD cents (e.g., $100 = 10000) for `data-amount
`.
**To add monthly payment messaging and a product modal to your cart page:**
Be sure to use your page's price variable or price amount in USD cents (e.g., $100 = 10000) for `data-amount
`.
**To add a site modal to a text link on your home page:**
**To add a site modal to a [banner](🔗) link:**
In each HTML element, be sure to include the `data-page-type
` attribute corresponding to the page where that promotional messaging component is placed. The `data-page-type
` attribute allows you to customize messaging in the future without development work. By default, promotional messaging on product pages have prequalification enabled, but you can work with your Client Success Manager to change this and [configure additional customizations](🔗). See the links below for additional sample code.