Customer age calculation

Published November 09, 2023
Modules
Difficulty

The Customer Age Calculation offers businesses a robust solution to automatically calculate their customers’ age based on the birthdate attribute.

This approach has several noteworthy benefits for businesses:

  • Improved Customer Insights: Access to age demographics enables more informed decision-making, enhancing the effectiveness of marketing initiatives and customer engagement strategies.
  • Personalized Customer Experiences: Armed with accurate age data, businesses can provide tailored interactions and experiences, such as age-specific discounts, content recommendations, and product suggestions.
  • Compliance and Age Verification: In industries governed by age-related regulations, such as age-restricted products or services, this use case serves as a robust tool for age verification, ensuring compliance and safeguarding against unauthorized access.

In this use case, you will verify the presence of the birthdate attribute within a customer’s profile. Upon confirmation, the use case proceeds with a series of precise calculations. In summary, this process simplifies age calculations, it will enrich customer understanding, enable personalized interactions, and contribute to more effective marketing campaigns and age-related compliance. What’s more, this calculation also takes leap years into account.

Prerequisites


  • Implement tracking code on your website.
  • Import of customer base with birthdate attribute.
Note: To collect birthdates from customers already in the database without this attribute, consider using targeted email campaigns with incentives, implementing loyalty programs that require birthdate information, engaging customers on social media with contests, and training customer support to politely request this missing data during interactions, emphasizing the benefits of sharing it. These methods will enhance your customer relationships and enable tailored marketing strategies.

Create an expression


Create an expression that will calculate age of a customer based on the birthdate attribute. The logic of the expression is as follows:

  1. If a customer’s birthdate in the profile is undefined, this expression returns null.

  2. If a customer’s birthdate in the profile is defined, the expression analyzes the month of the birthdate and the month of current date:

    • If the current month is before the month of birth, their age is calculated by this mathematical operation: current year - year of birth - 1.
    • If the current month is after the customer’s month of birth, their age is calculated by subtracting the year of birth from the current year.
    • If the current month is the same as the month of birth, the expression checks the day of birth and the day of the current date.
    • If the current day is before the birthday, their age is calculated by means of this mathematical operation: current year - year of birth - 1.
    • If the current day is the birthday or after, their age is calculated by means of this mathematical operation: current year - year of birth.
  3. The result is divided by the number of milliseconds in a year. To make it clear, in our example, we multiply 1 day in milliseconds (86400000) by the number of days in a year.

  4. The result is rounded down and presents the age of the customer.

  5. Go to Analytics icon Analytics > Expressions > New expression.

  6. Enter the name of the expression.

  7. As a type of expression, select Attribute.

  8. Build the following formula of the expression:
    Part 1

    Expression settings
    Expression which counts the customer's age - part 1

    Part2

    Expression settings
    Expression which counts the customer's age - part 2

    Part3

    Expression settings
    Expression which counts the customer's age - part 3
    Click to see the video tutorial

  9. Save the expression.

Check the use case set up on the Synerise Demo workspace


Check the prepared expression directly in the Synerise Demo workspace.

If you don’t have access to the Synerise Demo workspace, please leave your contact details in this form, and our representative will contact you shortly.

Read more


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker