# Embed attributes

> Every data attribute and ShopAssistConfig key the loader reads, and the order in which configuration sources are merged.

Source: https://shopassist.coec.dk/docs/widget/embed-attributes · Updated 2026-10-01

The loader reads configuration from the script tag's `data-*` attributes, `window.ShopAssistConfig`, and JSON blocks on the page. Plugins set these for you; Generic stores set them by hand.

## Attributes [#attributes]

| Attribute                                                                                             | Config key                            | Values                                                                  |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------- | ----------------------------------------------------------------------- |
| `data-shopassist-key`                                                                                 | `publishableKey`                      | `pk_live_…` or `pk_test_…` (required)                                   |
| `data-platform`                                                                                       | `platform`                            | `generic` (default), `shopify`, `magento2`, `woocommerce`, `prestashop` |
| `data-locale`                                                                                         | `locale`                              | BCP 47 or platform form (`da_DK` → `da-DK`)                             |
| `data-currency`, `data-country`                                                                       | `currency`, `country`                 | Hints only                                                              |
| `data-launcher`                                                                                       | `launcher`                            | `default` or `none` (your own button calls `ShopAssist.open()`)         |
| `data-consent`                                                                                        | `consentMode`                         | `managed`: wait for `ShopAssist.setConsent()`                           |
| `data-debug`                                                                                          | `debug`                               | `1`: console diagnostics                                                |
| `data-position`, `data-accent-color`                                                                  | `theme.position`, `theme.accentColor` | Override the dashboard look                                             |
| `data-logged-in`                                                                                      | `customerLoggedIn`                    | `1`/`0`, a hint only                                                    |
| `data-page-type`, `data-product-id`, `data-variant-id`, `data-category-id`                            | `page.*`                              | Page context                                                            |
| `data-cart-page-url`, `data-checkout-url`, `data-cart-add-url-template`                               | `endpoints.*`                         | Same-origin URLs                                                        |
| `data-identity-url`, `data-cart-api-url`, `data-store-api-url`, `data-session-url`, `data-proxy-path` | `endpoints.*`                         | Set by plugins                                                          |
| `data-api-base`, `data-asset-base`                                                                    | `apiBase`, `assetBase`                | Only ShopAssist hosts are accepted                                      |
| `data-design-mode`, `data-consent-api`, `data-cookie-restriction`                                     | —                                     | Set by plugins                                                          |

Every endpoint URL must be on the same origin as the page; others are dropped.

## Precedence [#precedence]

Later sources win (nested objects are merged):

1. Built-in defaults
2. `data-*` attributes of the script tag
3. `window.ShopAssistConfig`
4. `<script type="application/json" id="shopassist-config">`
5. `<script type="application/json" id="shopassist-page">` (page context only)
6. `ShopAssist.setPageContext()` at run time

```html
<script>
  window.ShopAssistConfig = { publishableKey: "pk_live_YOUR_PUBLISHABLE_KEY", platform: "generic", locale: "da-DK" }
</script>
<script type="application/json" id="shopassist-page">
  { "type": "product", "productId": "SHIRT-42" }
</script>
```

## Late configuration [#late]

Optimisation tools that delay scripts (WP Rocket "Delay JS", Cloudflare Rocket Loader) can run the loader before your configuration. The loader retries at `DOMContentLoaded`, at `load` and 2 seconds later, then gives up silently (`data-debug="1"` logs why).
