---
title: Content Cards on a Website
slug: docs/content-cards-on-a-website
docTags: 
createdAt: 2024-11-14T06:59:37.249Z
---

Content Cards are a **digital messaging feature** that allows brands to deliver persistent, non-intrusive, and engaging messages directly on the website. These cards present personalized, rich media content, such as offers, updates, or recommendations, without interrupting the user's flow. They stay visible on the website until the user interacts with them.&#x20;

:::hint{type="success"}
To see the live working example of this scenario visit the Luma home page [https://dsn.adobe.com/web/luma3](https://dsn.adobe.com/web/luma3). Scenario description is here [Content Cards in Luma](docId:6W2vahjmxvpbsIJgRgRs1)&#x20;
:::

### Prerequisites:

1. Create a web project using DSN Quick Setup (Example: [https://dsn.adobe.com/docs/retail-demo-environment)](https://dsn.adobe.com/docs/retail-demo-environment)
2. Make sure the project is connected to Data Collection on the project integrations tab
3. Ensure the Data collection datastream has the Adobe Journey Optimizer checkbox checked for the *Experience Platform.*



![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/z5-OYANF3b8KDSv_oO8cr_image.png)

### Setup:

### Create a content card configuration

1. Navigate to **Channels > Channel Configurations** menu.

- Click **Create channel configuration.**

﻿


![](https://images.archbee.com/bAgVaanSi1tFmfc8PghaH/jeInuICtoi8AP2lQzbxQG_image.png?format=webp)

2\. Enter Configuration Details

- Provide a **name** and an optional **description** for the configuration.
- **Note**: Names must start with a letter (A-Z) and can only contain alphanumeric characters, underscores (\_), dots (.), and hyphens (-).

3\. Choose the **Content Cards&#x20;**&#x63;hannel for the configuration.


![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/0LPQsOQaXEpAHNe388Ho-_image.png)

4\. Choose the platform: **Web** where the content card experience will apply:

- Specify a **Page URL** to target a single page.
- Or, create a **Pages matching rule** to apply changes to multiple URLs that meet the rule. This is useful for making global changes across a website, such as updating a hero banner or adding an image across product pages.

:::hint{type="info"}
**&#x20;Location -&#x20;**<u>**ContentCardContainer**</u>**&#x20;as seen in the screenshot below is the unique identifier for the content card.&#x20;**
:::





![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/0XWCI4nN5SVO5hzXjc9qA_image.png)

5\. After configuring the settings, submit your changes.

Once completed, you can use your new configuration when creating a **Content card experience.**

### Create content cards

To begin building your content cards through a campaign, follow these steps:

1. Navigate to Journey Management> Campaigns. Create a Campaign.

﻿


![](https://images.archbee.com/bAgVaanSi1tFmfc8PghaH/1Do2gI7UHYZcuAoafzo0m_image.png?format=webp)

2\. Select Campaign Type as "Scheduled"

﻿


::Image[]{src="https://images.archbee.com/bAgVaanSi1tFmfc8PghaH/_vVrMvdpYMraOOkhrlAiM_image.png?format=webp" size="58" width="868" height="1114" position="center" showCaption="false"}

3\. Define Campaign Properties:&#x20;

- In the **Properties** section, provide a name and description for the campaign.

﻿


![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/9NswRO3MVmrYxh6onQvnY_image.png)

4\. Choose Your Audience:

- In the **Audience** section, click **Select Audience** to choose from the available Adobe Experience Platform audiences.&#x20;
- In the **Identity namespace** field, select the appropriate namespace to identify individuals in the segment.

﻿


![](https://images.archbee.com/bAgVaanSi1tFmfc8PghaH/mY7FC6WsKGKfs1M4_O_5z_image.png?format=webp)

5\. Choose the **Content card action&#x20;**&#x66;or the campaign.

6\. Select or Create a Content Card Configuration

In our case, select an existing content card configuration- **ContentCardsWeb**



![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/hzE1bGNU7AiaF6jxSxhzP_image.png)

7\. Enable Additional Delivery Rules (Optional):

- If needed, toggle **Enable additional delivery rules**. You can then click **Edit triggers** to define the events and criteria for message delivery using the rule builder.

Let's keep the triggers empty.

﻿


![](https://images.archbee.com/bAgVaanSi1tFmfc8PghaH/g5YsP0y3Rw_OuKmEwqJx5_image.png?format=webp)

8\. Set your campaign to run on a specific date or recur at regular intervals

﻿


![](https://images.archbee.com/bAgVaanSi1tFmfc8PghaH/QmwkUMrtj6U9-2QDg89I__image.png?format=webp)

9\. Begin creating the content by clicking **Edit content**.


![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/LWsmEL2wA-D6vWmsZEKdT_image.png)

**Target**: To provide the target value, it has to be a page URL. Example:

[https://dsn.adobe.com/web/luma3/fall-24-collection](https://dsn.adobe.com/web/luma3/fall-collection)

Go to your target page and copy the link from the URL.



*Provide sample content as below:&#x20;*

**Title**: Explore the Fall '24 Collection

**Body**: Embrace fall with cozy, stylish essentials.

**Media Url**: [[[https://demo-system-next.s3.amazonaws.com/assets/luma/fall-collection-web.jpg](https://demo-system-next.s3.amazonaws.com/assets/luma/fall-collection-web.jpg)](https://as2.ftcdn.net/v2/jpg/09/21/80/11/1000_F_921801165_CPowIyk2b5kguCKufJXZlEXIWQsRUy1H.jpg)](https://t4.ftcdn.net/jpg/09/29/45/99/240_F_929459911_XLhX1UScH55K1JfWU2D1FLFLOC0xJ3ey.jpg)﻿

**Button Label**: Shop Fall Collection

**Target**: [https://dsn.adobe.com/web/luma3/fall-24-collection](https://dsn.adobe.com/web/luma3/fall-24-collection)


![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/-JmR6ewow7XS_rmq-Sa_5_image.png)

### Update the AEP Data Collection tag property configuration

To display the Content Cards on the DSN web project, you will have to update the rule in the tag property.

<u>**Update the Tag properly Web view rule**</u>

1. Go to your web project --> integrations and open your Data Collection property
2.

   ![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/Oj5cH5sMshLF1hTQWFgim_image.png)
3. Using the menu, click on **Rules**
4. Click on the rule **Page View&#x20;**&#x74;o edit the configuration. Click on the action - **'Send "PageView" Experience Event'.&#x20;**&#x41;dd a surface under surfaces - for example -web://dsn.adobe.com/luma3/home#ContentCardContainer. When you are using your custom project it would be web://dsn.adobe.com/projectName/page#location. This location needs to match the location specified when creating the channel configuration. &#x20;
5.

   ![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/cH6cuBPbAn7SmcmYsj9X__image.png)
6. ![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/jI4w6-ZjVUsfjSIGQOBLB_image.png)

:::hint{type="info"}
Following steps 1-6 are temporary. The Rule: Subscribe ruleset items will be part of the Luma preset soon and these docs will be updated.
:::



1. In the **Events**, click on the **+&#x20;**&#x62;utton to add an event.&#x20;
2. Select **Extension&#x20;**&#x61;nd set it t&#x6F;**&#x20; Adobe Experience Platform Web SDK,&#x20;**&#x73;e&#x74;**&#x20;Event Type&#x20;**&#x74;&#x6F;**&#x20;Subscribe ruleset items and Name&#x20;**&#x74;&#x6F;**&#x20;Adobe Experience Platform Web SDK - Send event complete.&#x20;**&#x4F;n the right side, under Schemas, select Manually Enter Schemas and select Value - **Content Card.&#x20;**&#x55;nder surfaces, provide surface name as done in the previous step.
3.

   ![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/5r99L_k16y2esHnwp0EtW_image.png)


4. In the **Actions**, click on the **+&#x20;**&#x62;utton to add a new action
5. In the action, set the Extension to **Core,&#x20;**&#x74;he Action Type to **Custom Code**, set the name to **Display Content Card**, set the language to **JavaScript&#x20;**&#x74;hen click on **Open Editor**
6. Copy and paste the following code in the Data Collection code editor, make sure t&#x6F;**&#x20;update the ID in the code on line 23 which should be the same as provided on the website configuration page.**

```javascript
if (!Array.isArray(event.propositions)) {
  console.log("No personalization content");
  return;
}

console.log("##Received response##", event.propositions);

event.propositions.forEach(function (payload) {
  payload.items.forEach(function (item) {
    if (!item.data || !item.data.content || item.data.content === "undefined") {
      return;
    }
    const { content } = item.data;
    const { title, body, image, buttons } = content;
    const titleValue = title.content;
    const description = body.content;
    const imageUrl = image.url;
    const buttonLabel = buttons[0]?.text.content;
    const buttonLink = buttons[0]?.actionUrl;
    const html = `<div  class="Banner Banner--alignment-left Banner--verticalAlignment-middle hero-banner ContentCardContainer"  oxygen-component-id="cmp-0"  oxygen-component="Banner"  role="presentation"  style="color: rgb(255, 255, 255); height: 300px">  <div class="Image" role="presentation">    <img      src="${imageUrl}"      alt="UNLEASH YOUR STYLE WITH NEW APPAREL COLLECTION banner"      style="object-fit: cover; height: 500px"    />  </div>  <div class="Banner__content">    <div class="Title Title--alignment-right Title--textAlignment-right">      <div class="Title__content" role="presentation">        <strong class="Title__pretitle">${titleValue}</strong>        <h2>${description}</h2>      </div>    </div>    <div class="Button Button--alignment-right Button--variant-cta">              <button          class="Dniwja_spectrum-Button Dniwja_spectrum-BaseButton Dniwja_i18nFontFamily Dniwja_spectrum-FocusRing Dniwja_spectrum-FocusRing-ring"          type="button"          data-variant="accent"          data-style="fill"          onclick="location.href='${buttonLink}'"        >          <span            id="react-aria5848951631-49"            class="Dniwja_spectrum-Button-label"            >${buttonLabel}</span          >        </button>            </div>  </div></div>`;
    if (document.querySelector(".ContentCardContainer")) {
      const contentCardContainer = document.querySelector(
        ".ContentCardContainer"
      );
      contentCardContainer.innerHTML = html;
      contentCardContainer.style.height = "300px";
    }
  });
});

```

### Configure Website for Content Cards

1. Open web project in builder configuration.
2. Navigate to the Home screen(or any screen)
3. Add module - **Banner&#x20;**&#x75;nder General categor&#x79;**.**
4. Click on the component and open the right sidebar. In th&#x65;**&#x20;Styles&#x20;**&#x73;ection - provide value for Custom CSS Classes as **ContentCardContainer**.&#x20;

:::hint{type="warning"}
The class name must match the id used in the script code mentioned above, to render the card in the&#x20;
:::

In our case: **ContentCardContainer** is the location on the page where Content Cards will be rendered.



![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/ortFEVi2bnC0HblaPup35_image.png)

5\. Open the website. Navigate to the home screen. The content card should be rendered in the place you have added the banner.


![](https://api.archbee.com/api/optimize/bAgVaanSi1tFmfc8PghaH/Pz0ANcCZ_Gj7pFQsqE4aY_image.png)

