Email Marketing Tool

DougieD
Member

Personalizing email content based on user profile variable

SOLVE

Hi there,

 

Just reaching out to see if anyone can advise on how to personalize email content. The Smart Content feature becomes unwieldy when there's numerous variables, so I'm hoping there's an alternative.

 

On our B2C platform we use personalization tokens to insert user profile data - something like:

 

Welcome to [Contact.BrandName]!

 

For personalized graphics we use:

 

https://www.website.com/files/images/[Contact.BrandName]-logo.png

 

Is there a similar way to program emails in Hubspot?

 

Thanks for the help!

 

Doug

0 Upvotes
1 Accepted solution
MatthewShepherd
Solution
HubSpot Moderator
HubSpot Moderator

Personalizing email content based on user profile variable

SOLVE

Hi @DougieD 

 

Are you currently using personalization tokens to insert personalized email content? Or are you using Smart Content to show different block of text with your the personalized values written manually? Inserting personalization tokens from the email editor toolbar is the first solution here.

 

If you are looking to avoid using this feature you could just enter the corresponding contact HUBL variables (which is all the insert personalization token toolbar feature is doing for you)

 

{{ contact.company }}

or you could create custom contact properties and use HUBL to insert those 

{{  contact.mycustompropertyinternalname }}

 


Matthew Shepherd

Senior Inbound Consultant

Professional Services | HubSpot

He/Him

linkedin.com/in/matthewshepherd/
https://www.hubspot.com/services/professional

View solution in original post

9 Replies 9
MatthewShepherd
Solution
HubSpot Moderator
HubSpot Moderator

Personalizing email content based on user profile variable

SOLVE

Hi @DougieD 

 

Are you currently using personalization tokens to insert personalized email content? Or are you using Smart Content to show different block of text with your the personalized values written manually? Inserting personalization tokens from the email editor toolbar is the first solution here.

 

If you are looking to avoid using this feature you could just enter the corresponding contact HUBL variables (which is all the insert personalization token toolbar feature is doing for you)

 

{{ contact.company }}

or you could create custom contact properties and use HUBL to insert those 

{{  contact.mycustompropertyinternalname }}

 


Matthew Shepherd

Senior Inbound Consultant

Professional Services | HubSpot

He/Him

linkedin.com/in/matthewshepherd/
https://www.hubspot.com/services/professional
DougieD
Member

Personalizing email content based on user profile variable

SOLVE

Quick follow up if you have a moment ...

 

I'm trying to build an if/else statement in HUbL but I don't think I have it quite right.

 

I would like a snippet of code to appear if a user variable exists. If not, I would like it to default to a different snippet of code.

 

Here's my code so far. Any ideas?

 

{% if contact.variable %}

 

<img src="https://website.com//{{ contact.variable }}.png"/>

 

{% else %}

 

<img src="https://website.com/logo.png />

 

{% endif %}

 

0 Upvotes
MatthewShepherd
HubSpot Moderator
HubSpot Moderator

Personalizing email content based on user profile variable

SOLVE

Hi @DougieD 

This looks correct....with the exception of the // in your img src url, there should just be a single forward slash before the contact variable, https://website.com//{{ contact.variable }}.png.

 

{% if contact.variable %} is checking to see if a contact property with an internal name of variable (in practice this would be something like contact.firstname or the actual internal name of your contact property) is defined. If the property variable has a value it should output your first image tag and if it has no value it should default to your second image tag.

What is happening when you use this code?


Matthew Shepherd

Senior Inbound Consultant

Professional Services | HubSpot

He/Him

linkedin.com/in/matthewshepherd/
https://www.hubspot.com/services/professional
0 Upvotes
DougieD
Member

Personalizing email content based on user profile variable

SOLVE

Thanks so much, Matthew! It appears the merge values are working as exptected. I need the inserted value to be converted to lowercase, however. I tried this but it doesn't seeem to be working. Any ideas?

 

https://website.com/{{ contact.variable|lower }}.png

0 Upvotes
MatthewShepherd
HubSpot Moderator
HubSpot Moderator

Personalizing email content based on user profile variable

SOLVE

{{ contact.variable|lower }} should work.

 

Is your variable a string? Does it contain any numbers etc.?


Matthew Shepherd

Senior Inbound Consultant

Professional Services | HubSpot

He/Him

linkedin.com/in/matthewshepherd/
https://www.hubspot.com/services/professional
0 Upvotes
DougieD
Member

Personalizing email content based on user profile variable

SOLVE

Thanks, Matthew. It's a text string without numbers, like this:

 

https://www.website.com/ABCD.png

 

It should be 

 

https://www.website.com/abcd.png

 

It's successfully pulling in the ABCD part but not converting it to lowercase.

 

Doug

0 Upvotes
MatthewShepherd
HubSpot Moderator
HubSpot Moderator

Personalizing email content based on user profile variable

SOLVE

Hi @DougieD 

I forgot you were implementing this in an email template where filters on personalization variables aren't supported:

 

"Please note that using filters on personalization variables (contact and company variables) is not currently supported for email in HubSpot. Filters can be applied to these properties on HubSpot CMS page and blog templates."

 

https://designers.hubspot.com/docs/hubl/hubl-supported-filters

 

A workaround could be to use Zapier.com to change the case of your contact property and store it in a separate field.


Matthew Shepherd

Senior Inbound Consultant

Professional Services | HubSpot

He/Him

linkedin.com/in/matthewshepherd/
https://www.hubspot.com/services/professional
0 Upvotes
DougieD
Member

Personalizing email content based on user profile variable

SOLVE

Thanks, Matthew! That makes sense. I really appreciate your help!

 

Doug

0 Upvotes
DougieD
Member

Personalizing email content based on user profile variable

SOLVE

Thanks, Matthew! I think the HUBL solution will work. Super appreciate your help!

0 Upvotes