createEvent
Adds or updates a contact in a Mailchimp audience and creates an event. Under the hood, this action calls the add or update a list member and create an event for a list member API endpoints.
Configuration
This function type accepts the following parameters:
Key | Type | Default | Description |
---|---|---|---|
apiKey | string | @mailchimp-api-key | Your Mailchimp API key |
audience | string | @mailchimp-audience | Your Mailchimp audience ID |
statusIfNew | object | subscribed | The subscriber's status (see here for available values) |
mergeFields | object | {} | Static merge fields to set on the contact |
Example
{"functions": {"trackEvent": {"app": "mailchimp","type": "createEvent","audience": "5ca598e7e8","mergeFields": {"PLAN": "pro"}}}}
Arguments
This function type accepts the following client-side arguments when called:
Key | Type | Default | Description |
---|---|---|---|
emailAddress * | string | The contact's email address | |
eventName * | string | The name of the event (lowercase, no spaces, 2 - 30 characters) | |
eventProperties | object | {} | A collection of event properties |
isSyncing | boolean | false | If true , skips running automations for this event |
mergeFields | object | {} | Dynamic merge fields to set on the contact |
Example
import { createClient, trackEvent } from '@statickit/functions';let client = createClient({ site: '{your-site-id}' });let { status } = await trackEvent(client, {emailAddress: "janedoe@example.com",eventName: "purchased",eventProperties: {item: "t-shirt"}});
Response
Returns a status
and the following properties when successful:
Key | Type | Description |
---|---|---|
id | string | The MD5 hash of the lowercase version of the list member's email address. |