Solved

Personalisation and Dr, Mr etc

  • 11 April 2024
  • 2 replies
  • 23 views

Badge +3

How do I prevent a person’s title - eg Mr or Dr, etc - appearing in a personalisation field? Eg, if somebody has their name as Dr Shirley Smith, adding a first name personalisation would end up with ‘Hello Dr’ instead of ‘Hello Shirley’.

icon

Best answer by bluesnapper 11 April 2024, 18:38

View original

2 replies

Userlevel 7
Badge +36

Hi @AnnaE 

The only way I know to clean up a person’s title that appears in the first name field e.g Dr, Mr, Mrs etc, is to export a list into Excel, identify those contacts, clean them up, and re-import only those contacts back into your list. You need to ensure you don’t change their subscription status.

However, I often find that a contact adds their info as first name = Dr and last name = Smith, so there’s not much you can do to clean those up to use first name for personalisation.

The other consideration is that a contact with the title Dr can be quite precious about being referred to by that title! I live in Oxford so maybe that’s just around here...😁

You could take this Show/Hide Logic approach if the numbers of Drs warrant it:

Dr text block
Hello Dr {{ last_name|title| }}

Set Show/Hide Logic to: 

"Dr " in person|lookup:'first_name' or "DR " in person|lookup:'first_name' or "Dr." in person|lookup:'first_name' or "DR." in person|lookup:'first_name' 

Examples of when the block WILL show
first name = Dr Andy last name = Dawson (output is 'Hello Dr Dawson ')
first name = Dr last name = Dawson (output is 'Hello Dr Dawson ')
first name = Dr. Andy last name = Dawson (output is 'Hello Dr Dawson ')
first name = Dr. last name = Dawson (output is 'Hello Dr Dawson ')

Note that there is a space after 'Dr ' and 'DR ' in the first two instances (above and below) - this is so it will only match the above firstname forms when Dr/Dr is there. The space is required to stop the block from appearing when the firstname is, for example 'Drew'. Please check through that logic in case I've missed a first name that may trigger the block. 

NON-Dr text block
Hello {{ first_name|title|default:'there' }}

​Set Show/Hide Logic to: 

not "Dr " in person|lookup:'first_name' and not "DR " in person|lookup:'first_name' and not "Dr." in person|lookup:'first_name' and not "DR." in person|lookup:'first_name' 

This block won’t show if there’s one of those Dr forms in the firstname but it will show for all others.

Bolding is to highlight the different logic clauses.

I’ve tested and it works but please check.

Hope that helps

Regards

Andy
 

Userlevel 1
Badge +1

Hey Anna,

If you want the data completely removed from the field, you could consider implementing a Zapier setup before having subscribers added. The Zapier setup could contain a piece of python code that would remove the title from the first name.

It would look something like:

def remove_titles(name):
# List of titles to be removed
titles = ["Dr", "Mr", "Mrs", "Ms", "Miss", "Prof", "Sir"]

# Split the name into parts
name_parts = name.split()

# Check if the first part of the name is a title and remove it
if name_parts[0] in titles:
return ' '.join(name_parts[1:])
else:
return name

# 'input_data' is a dictionary provided by Zapier, containing data from previous steps
# Example: input_data = {'name': 'Dr. John Doe'}

# Retrieve the name from 'input_data'
name_with_title = input_data['name']

# Process the name to remove any titles
name_without_title = remove_titles(name_with_title)

# Prepare the output to be passed to the next step in your zap
output = {'name_without_title': name_without_title}

Let me know if you need any assistance :)

/Casper

Reply