> For the complete documentation index, see [llms.txt](https://even-financial.gitbook.io/developer-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://even-financial.gitbook.io/developer-center/marketplace-integrations/web-embeds/credit-cards-marketplace.md).

# Credit Cards Marketplace

{% hint style="success" %}
This page outlines what's needed to integrate Engine's **Credit Card Embed** into your website. In this guide, we will explore what Engine’s Embed syntax looks like and best practices for loading it on your site. This includes topics like proactively addressing layout shift for optimized performance.

This is a high-level guide, and specific implementation details should be discussed with your Engine team.
{% endhint %}

## Standard Embed Implementation

Engine's embed code can be placed in any order within your page, but for optimal user experience we recommend placing the `script` tag within the same div where the content is being rendered.

**Basic Embed Syntax**

{% hint style="info" icon="triangle-exclamation" %}
**PLEASE NOTE**: Your Engine representative will provide you with your specific code snippet. Do not try to reproduce from the sample snippet outlined below.
{% endhint %}

<pre class="language-html" data-overflow="wrap"><code class="lang-html">&#x3C;script
<strong>    async
</strong>    src="https://www.moneylion.com/network/{channel}/{zone}/web-component/{component-name}/index.js"
>&#x3C;/script>
&#x3C;moneylion-credit-cards>&#x3C;/moneylion-credit-cards> // used for Explore component
&#x3C;moneylion-credit-cards-search>&#x3C;/moneylion-credit-cards-search> // used for Search component
</code></pre>

This is a representative example of what our embed code looks like, and contains placeholders as defined below. Placeholders and will be replaced with precise values in the embed code provided to you.

#### **Embed Components**

* **Channel:** placeholder that will be replaced with precise values in the embed code provided to you.
* **Zone:** placeholder that will be replaced with precise values in the embed code provided to you.
* **Component Name:** corresponds to the specific product or Engine experience type that's being rendered.

#### **Customization & Auto Sizing**

The web component loads iFrame and will automatically fill the container. Embeds are rendered wherever you include our HTML tag on your page and will responsively scale to fill the space available to it.

## Credit Cards Specific Syntax

#### Component Names

* **`/web-component/credit-cards-search/`:** A full application-style flow where the user enters key info (income, credit, loan amount, etc.) and Engine returns personalized loan matches in-session. Use this when you want a “start here, answer a few questions, get matched” experience as the primary entry point.
* **`/web-component/credit-cards/`:** A browse-and-filter offers experience that leans on data you already have (or have prefilled) to show preview or pre-qualified offers up front. Use this when you want a “see your loan options and refine” experience inside an existing logged-in area or dashboard.

## Credit Cards Embed Demo

{% embed url="<https://www.moneylion.com/credit-cards/best>" %}

## Client Tags & Prefilling Customer Data

Engine Embeds support the ability to add certain tags with varying use cases, which are outlined in this section.

#### Use Cases **for** Client Tags

* Prefilling customer data for certain non-PII fields
  * Decreases friction in the user experience and increases application submission rates
  * Useful when you already have that info on hand for that user, or want the front-end to default to particular values
* [Broken mention](broken://pages/QX6wgRrWroljfkZv7FAJ)

#### How to Implement Client Tags for Reporting & Customer Data Prefill

To **add client tags** in an embed, use the following syntax in the `tags` attribute within the embed component tag:

```
tag.key_1=value_1&tag.key_2=value_2
```

To **prefill fields** in an embed, use the following syntax in the `data-tags` attribute within the embed script:

```
app.key_1=value_1&app.key_2=value_2
```

#### <mark style="color:$primary;">Sample Implementation</mark>

{% code overflow="wrap" %}

```html
<script 
      async 
      src="https://www.moneylion.com/network/{channel}/{zone}/web-component/{component-name}/index.js\" 
></script>
<moneylion-credit-cards       
      tags="tag.clientId=c1&tag.source=email&app.providedCreditRating=excellent&app.zipcode=93105\"
></moneylion-credit-cards>
```

{% endcode %}

<mark style="color:$primary;">In the above example,</mark> <mark style="color:$primary;">`clientId`</mark> <mark style="color:$primary;">and</mark> <mark style="color:$primary;">`source`</mark> <mark style="color:$primary;">are available as tags for reporting purposes and the embed</mark> <mark style="color:$primary;">`providedCreditRating`</mark> <mark style="color:$primary;">and</mark> <mark style="color:$primary;">`zipcode`</mark> <mark style="color:$primary;">fields will be prepopulated when the embed is rendered.</mark>

#### Supported Client Tag Keys

{% hint style="warning" %}
**Client tag keys are matched exactly, including case.** For example - `subid` and `subId` are stored as separate tags and will appear as separate keys in your reporting.

**Please send each key with consistent casing across all requests, and use the exact spelling shown above.**
{% endhint %}

Below are the client tag keys that are currently supported:

* agentId
* campaignId
* clickId
* clientId
* deviceId
* medium
* sourceId
* subId
* subId1
* subId2
* subId3
* target
* trafficsource
* userId

If a different key is needed, please reach out to your Partner Manager - we *may* be able to accommodate, but adding nonstandard keys will increase the time it takes Engine to report Client Tag values back to you and is therefore not recommended.

#### **Supported Keys for Credit Cards Customer Data Prefill**

The following is a list of params that can be added to the Credit Cards embed code to prefill in the embed frontend:

| Key              | Purpose                                                                           |
| ---------------- | --------------------------------------------------------------------------------- |
| app.annualIncome | Annual income (number)                                                            |
| app.firstName    | First name                                                                        |
| app.lastName     | Last name                                                                         |
| app.email        | Email (valid formatting)                                                          |
| app.primaryPhone | <p>Phone number</p><p>(XXX-XXX-XXXX; must be 10 digits or 11 starting with 1)</p> |
| app.dateOfBirth  | Date of birth (mm/dd/yyyy)                                                        |
| app.address1     | Address line 1                                                                    |
| app.address2     | Address line 2                                                                    |
| app.city         | City                                                                              |
| app.state        | State (valid state code, e.g. "CA")                                               |
| app.zipcode      | Zipcode                                                                           |

## Tracking Events Emitted by Embed

When you embed the Credit Cards experience, event callbacks will fire by default.

#### How It Works

As a consumer navigates through the experience, the embed emits **partner messages**: JSON objects with a `name` (the event type) and a `payload` (event-specific data). The iframe posts them to your host page via `window.parent.postMessage(message, '*')`.

* **You do not register callbacks with Engine.** You listen on your host page; messages arrive whether or not you handle them.
* **Not every UI action sends a message.** Only the events listed below are part of the partner contract. Other activity (e.g. form display, page load) is used internally and is not posted to the host.
* **Messages are one-way.** There is no acknowledgement or response channel.

#### Implementation Path

Partners using Web Embed receive events by listening for browser `message` events on the host page:

```js
window.addEventListener('message', (event) => {
  const message = event.data
  if (!message || typeof message !== 'object' || typeof message.name !== 'string') {
    return
  }
  console.log(message.name, message.payload)
})
```

The message shape is always:

```json
{
  "name": "onOfferClick",
  "payload": {}
}
```

#### Events & Data

**`onOfferClick`:** Emitted when a user clicks an offer CTA. Suppressed if no `leadUuid` is available.

```json
{
  "name": "onOfferClick",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "leadUuid": "00000000-0000-0000-0000-000000000000",
    "offerUuid": "1f5bf62b-9e0f-40ef-91ef-84b5c01942ac",
    "financialInstitutionBrandName": "Chase",
    "cardName": "Sapphire Preferred",
    "isITA": true,
    "cardNetwork": "visa"
  }
}
```

**`onUpdate`:** Emitted when a search step is submitted. For normal submissions, `editingPage` is omitted / `undefined`. For confirmation edit submissions, `editingPage` is an array of edited pages.

```json
{
  "name": "onUpdate",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "updatePage": "email",
    "leadUuid": "00000000-0000-0000-0000-000000000000"
  }
}
```

```json
{
  "name": "onUpdate",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "updatePage": "confirm",
    "editingPage": ["address"],
    "leadUuid": "00000000-0000-0000-0000-000000000000"
  }
}
```

**`onNavigate`**: Emitted when the search flow moves from one step to another.

```json
{
  "name": "onNavigate",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "fromPage": "email",
    "toPage": "address",
    "leadUuid": "00000000-0000-0000-0000-000000000000"
  }
}
```

**`onCreate`**: Emitted when a lead-created model is mounted for search or rate-table layouts. For non-edit flows, `editingPage` is `null`.

```json
{
  "name": "onCreate",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "leadUuid": "00000000-0000-0000-0000-000000000000",
    "createPage": "search",
    "editingPage": null
  }
}
```

**`onRateTableRender`**: Emitted when a rate table mounts with a rate table UUID and visible credit-card offer metadata.

```json
{
  "name": "onRateTableRender",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "rateTableUuid": "ab12cd34-ef56-7890-ab12-cd34ef567890",
    "creditCardOffers": [
      {
        "uuid": "1f5bf62b-9e0f-40ef-91ef-84b5c01942ac",
        "financialInstitutionBrandName": "Chase",
        "cardName": "Freedom Unlimited",
        "isITA": true,
        "cardNetwork": "visa"
      }
    ]
  }
}
```

**`onErrorPageRetry`**: Emitted when a user clicks retry from a search error page.

```json
{
  "name": "onErrorPageRetry",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "leadUuid": "00000000-0000-0000-0000-000000000000",
    "toPage": "search",
    "editingPage": null
  }
}
```

**`onSubmit`**: Emitted when the final credit-card search is submitted.

```json
{
  "name": "onSubmit",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "leadUuid": "00000000-0000-0000-0000-000000000000"
  }
}
```

**`onErrorPageView`**: Emitted when a search error page is viewed.

```json
{
  "name": "onErrorPageView",
  "payload": {
    "timestamp": "2026-04-07T00:00:00.000Z",
    "leadUuid": "00000000-0000-0000-0000-000000000000",
    "fromPage": "search"
  }
}
```

Two events are SDK-only and will not be emitted by the Engine web embed:

* **`onBack`**: Emitted by the SDK header back button
* **`onExit`**: Emitted by the SDK header exit button

## **Embed Best Practices & Troubleshooting**

{% hint style="success" %}

#### Best practices

1. **Use the snippet Engine gives you.** Don't hardcode channel, zone, or component paths yourself.
2. **Keep `async` on the script tag.** This prevents the embed script from blocking the rest of your page.
3. **Give the embed a real container.** Set a width on the parent. Set a `min-height` when possible. This gives the iframe room to render and avoids large layout shifts.
4. **Allow Engine in your CSP.** Your Content Security Policy must allow the Engine script in `script-src` and `https://www.moneylion.com` (or your Engine environment host) in `frame-src`.
5. **Follow this page's tags and prefill guidance.** Attributes differ by product. Use this page's sample, or your Engine-provided snippet, rather than copying syntax from another embed.
   {% endhint %}

{% hint style="warning" %}

#### Troubleshooting

**The component doesn't show**

1. Check your install mode:
   * **Explicit custom element:** Confirm the `moneylion-*` element from your snippet is on the page.
2. Open the browser console. Check for script load failures or CSP blocks.

**The page feels slow**

1. Confirm the `async` attribute is on the `<script>` tag.
2. Avoid nesting the embed in a hidden container, such as `display: none`, at first load. This can delay useful height and layout work.

**Events aren't firing**

1. Confirm you listen for `message` events. Check for `{ name, payload }` objects. See the tracking section on this page for product-specific events.
2. In production, filter by Engine's origin. This ignores unrelated `postMessage` traffic from other page scripts.
   {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://even-financial.gitbook.io/developer-center/marketplace-integrations/web-embeds/credit-cards-marketplace.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
