Syntax
customer.metafields.lantern.activity_feed
Description
The activity_feed metafield contains the customer’s recent activity events for display in customer dashboards or activity summaries. This includes metrics-tracked events like purchases, referrals, and other engagement activities.
The activity feed metafield contains JSON data that must be parsed using Liquid’s parse_json filter before accessing individual properties.
Properties
Type: JSON Object
Namespace: lantern
Return Values
| Scenario | Value | Type |
|---|
| Customer has activity events | Activity feed object | JSON Object |
| Customer has no activity | {"events": []} (empty events array) | JSON Object |
| Logged out | null | null |
Activity Feed Structure
events (array): list of recent customer activity events.
Event Object Structure
Each event in the events array contains:
| Field | Type | Description |
|---|
id | string | Unique event identifier |
data | object | Event-specific data payload |
timestamp | string | Event timestamp in ISO format |
metric.id | string | Metric identifier |
metric.name | string | Human-readable metric name |
metric.handle | string | Metric handle/slug |
Examples
Basic Activity Display
{% assign activity_data = customer.metafields.lantern.activity_feed %}
{% if activity_data %}
{% assign activity = activity_data | parse_json %}
{% if activity.events.size > 0 %}
<div class="activity-feed">
<h3>Recent Activity</h3>
{% for event in activity.events %}
<div class="activity-item">
<h4>{{ event.metric.name }}</h4>
<p>{{ event.timestamp | date: '%B %d, %Y' }}</p>
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}