User Meta for Audience Targeting
planned
V
Vinny Green
You can see the code I used here:
https://webmultipliers.com/registering-customer-tags-in-altis-analytics-410/
V
Vinny Green
Got it! This is going to be great. I would recommend moving the field registration to the admin.
Robert O'Rourke
The way you'd achieve this at the moment is two-fold, using a filter and then further registering a field for use with audiences eg:
add_filter( 'altis.analytics.data.endpoint', function ( $endpoint ) {
$endpoint['Attributes'] = $endpoint['Attributes'] ?? [];
$endpoint['Attributes']['meta_key'] = (array) wp_get_current_user()->get( 'meta_key' );
// ... etc ...
return $endpoint;
} );
Altis\Accelerate\Audiences\register_field(
'endpoint.Attributes.meta_key',
__( 'My custom field' ),
[
'column' => "endpoint['attributes']['meta_key']",
]
);
I think we could make that a bit more straightforward, with a single function call that just needs the meta key name and a description.
Would a code solution work for you Vinny?
V
Vinny Green
Robert O'Rourke: I didn't know about the register field part, so once I do that, I'll be good to go.
Noel Tock
planned
V
Vinny Green
Noel Tock: I'm working with the creator of WPShop to sync shopify customer data to the user profile.
The membership app that I use will set customer tags based on subscription status. If I could target the customer tag data to make audiences, I would use this to drive paywalls for member only content.
Noel Tock
That's a great shout @Vinny Green, moving to Planned. Any further use-cases are helpful too... Cheers!