Scenario:
In situations when you want to create audiences or use personalized synced patterns for WordPress logged-in users, such as an audience “WordPress Users who have a meta key is_subscribed_to_newsletter
“.
Accelerate provides the ability to create “audiences” which are certain facets / criteria against the “endpoint data”. The Endpoint Data is stored in the viewer’s browser (in Local Storage). This design allows for personalization features to work for all users (including new users) and doesn’t have an adverse performance impact on WordPress by storing data on-device rather than in the WordPress backend / database.
In situations when you want to include data from the WordPress database, or data on logged in users, additional steps are needed to register the fields and inject the data accordingly.
Register Attributes with Accelerate
The first step for any custom data tracking or targeting in Accelerate is to register a new “data attribute” so it can be used to creating / targeting audiences.
This will add a new field for targeting in the audience builder:

Filter the Endpoint data
Once a new field is registered for the new attribute, we must now inject the backend data (the is_subscribed_to_newsletter
user meta key) into the Endpoint Data. Remember: Audience criteria is always matched against the endpoint data. We need to populate the endpoint data from our WordPress data storage (user meta) by injecting our value into the endpoint data. This could be done in PHP via the altis.analytics.data.attributes
WordPress filter, or on the frontend via the JavaScript function Altis.Analytics.updateEndpoint
.
Depending on whether the value is readily available via PHP or via JavaScript should dictate your approach. In our example, let’s assume the PHP backend is the easiest way to inject the data:
Now whenever a user’s meta key for is_subscribed_to_newsletter
is changed, the endpoint data that is stored in the viewer’s browser will update. Any update to the Endpoint Data on the frontend will potentially change the matched audience.