Targeting: Audiences

Custom Stories Integration

πŸ“˜

How it works

The sendAudienceData function allows you to send custom data to the widget. Upon receiving new data, the widget automatically refreshes, displaying stories or content tailored to the user's profile

Usage

Add sendAudienceData without NPM

<script>function sendAudienceData(a){window.jDataLayer=window.jDataLayer||[],window.jDataLayer.push({type:"audience",data:a})}</script>

Import sendAudienceData with NPM

import { sendAudienceData } from "@join-stories/widget-bubble-list"

How to send data

The sendAudienceData function is versatile and can be integrated into various parts of your application as needed. Whether you're capturing user interactions through click events, responding to lifecycle events in components, or implementing any other logic, sendAudienceData can be effectively utilized.

To use the function, first define your audience data object with the relevant properties.
Here's an example:

const dataAudience = { age: myClient.age, clientStatus: myClient.status }

sendAudienceData(dataAudience)

Example without NPM

Example with NPM

Data structure

the sendAudienceData function expects data in the following format:

{
  [key: string]: string | number | boolean | string[] | null;
}