Skip to main content

Fix typos in Customer.io attributes — for real


Problem

You have a form on your website to collect email addresses, but users enter their email with a typo and you’re unable to deliver email to them. E.g. example@gmial.com instead of example@gmail.com.

 

Solution

I found this article in the customer.io docs titled “Fix typos in attributes”. However, it really should be titled “How to remove an attribute from a record” because it doesn’t fix a typo, it just removes an attribute.

Here’s how I fixed a common typo (that we were seeing) using JavaScript and some RegEx.

Step 1

Follow steps 1 and 2 in the above referenced article to create a segment that captures the misspelled attribute and to create a campaign using your new segment.

Step 2

  1. Use the Create or Update Person action in your workflow
  2. For the attributes to change, choose:
    1. ATTRIBUTE: email
    2. VALUE: JavaScript
  3. In the JavaScript field, I added:
return customer.email.replace(/@gmial\.com$/, '@gmail.com');

I appreciate how customer.io has the Preview attribute changes section that allows me/us to see if our JavaScript is going to have the desired change. Here’s a screenshot.

 

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings