Custom Preference Center - customizing the tokens

Your problem
My problem is:
image

I want to remove the default text “My segments” from the token {segmentlist}. Anyone know how?

Steps I have tried to fix the problem:
I tried thinking about the problem, didn’t help much.
I also tried putting on sweet sunglasses to look awesome. I did look awesome but it didn’t solve this problem.
So I asked here.

Your software
My Mautic version is: 4.4.5
My PHP version is: 7.4.33
My Database type and version is: 10.6.12-MariaDB-0ubuntu0.22.04.1

EP

Where exactly is that?

This is in Landing Page builder, with option * Set as preference center page* toggled Yes. Using the token {segmentlist} will auto-populate all segments marked Yes for option * Available in Preference Center*, for contacts to opt in/out of each specific list, from the Preference Center.

It’s a great approach and quite intuitive by design. Unfortunately the text “My segments” is baked into the token when it renders and I don’t know how/where to modify that.

How I would approach this is, I would find the implementation for { segmentlist} token in the core base, then copy it to new token, for example {mycustomsegmentlist} and for this custom token I would remove the “My Segments” from the output.

I do not think you can do this without coding at the moment.

1 Like

Custom tokens, you say? :face_with_monocle: Now that’s an interesting prospect.

While we’re on the subject…can system-wide tokens be created, for example, like the system {signature} token? It would be handy to have custom tokens that can push out universal info.

Here’s an example use case:
Periodic event announcements sent out to a list. One email needs to be created with a simple campaign to send it on schedule (and the campaign can be updated via API for automation). Now, the email can also be modified at this point. But it could also be handy to have a token, for example, {eventdetails} that injects a bit of HTML, updating the value of {eventdetails} by API or form submit…

Is that a major overhaul or more of a simple fix?

EP

You can register new tokens in Mautic by subscribing to the right Symfony events, without much hustle.

You need to get the info from somewhere and most of the time you would have to store that info into Mautic database, when you have that all you need to do is tell Mautic how to use the info from the database to produce output for {eventdetails} token.

Adding new tokens to Mautic is simple, its storing and processing the information from external system to get all the required data that needs some extra planning to make this effective.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.