Is there a way to create centralized tags / merge fields?

TheKnight

New Member
Our list has a lot of dynamic content that we update daily so that we can access in the form of merge fields to create custom messaging.

As our list has grown larger, and in that much of our dynamic content has 12 variations each day, updating each individual record with one of the 12 variations is time consuming and is using un-necessary bandwidth on the server.

Question - Instead of relying upon dynamic fields in a specific user record, is there another option available whereby we can update, in our case, just 12 fields each day instead of 12 x the number of records in our list?

So, similar to how the tags that are available to populate the company address details in the unsub slug are available for any email, we would want to have the ability to update these dynamic fields from a similar location...
 
we would want to have the ability to update these dynamic fields from a similar location...
There is a hook which you can use to add your own tags and parse them as you see fit, named campaigns_get_common_tags_search_replace, so you can programatically add new tags like:
PHP:
Yii::app()->hooks->addFilter('campaigns_get_common_tags_search_replace', function(array $tags, Campaign $campaign, ListSubscriber $subscriber = null, DeliveryServer $server = null){

    $tags['[WHATEVER_1]'] = 'this is the content for whatever 1';
    $tags['[WHATEVER_2]'] = 'this is the content for whatever 2';

    return $tags;
});

Now, if you also want the above tags to appear in the image you have displayed above, we have another hook you can use, that is campaign_template_available_tags_list, so:
PHP:
Yii::app()->hooks->addFilter('campaign_template_available_tags_list', function($tags) {

    $tags[] = ['tag' => '[WHATEVER_1]', 'required' => false];
    $tags[] = ['tag' => '[WHATEVER_2]', 'required' => false];

    return $tags;
});

So you can add the above code in a file called init-custom.php in /apps/ folder, so the final code would be:
PHP:
<?php

Yii::app()->hooks->addFilter('campaigns_get_common_tags_search_replace', function(array $tags, Campaign $campaign, ListSubscriber $subscriber = null, DeliveryServer $server = null){

    $tags['[WHATEVER_1]'] = 'this is the content for whatever 1, do your own logic for it';
    $tags['[WHATEVER_2]'] = 'this is the content for whatever 2, do your own logic for it';

    return $tags;
});

Yii::app()->hooks->addFilter('campaign_template_available_tags_list', function($tags) {

    $tags[] = ['tag' => '[WHATEVER_1]', 'required' => false];
    $tags[] = ['tag' => '[WHATEVER_2]', 'required' => false];

    return $tags;
});

This goes to say how powerful MailWizz really is...
 
Follow up question @twisted1919 ;

Can we insert a tag within a tag?

Consider the following...

We have 10 types of customers and use a tag, call it, [CUSTOMERTYPE] as a field associated with their record. Possible values are 1-10.

Those values are associated with dynamically changing content that changes every day.

We'd like to add our own tags, call it, [CONTENT1],[CONTENT2], through 10. and per your comment above we got that part. This will increase efficiency for us to update it in just that 1 location.

HOWEVER, to actually have the proper [CONTENT1], etc. data populate in the email, would it be possible to have a use case within a template that works like this...

Hello! Here is today's [[CONTENT][CUSTOMERTYPE]]

Would it work??
 
Back
Top