Use the contact_id attribute?

Hello :slightly_smiling_face:

I would like to be able to use a unique contact ID to set up a light & custom referral program.

I have the impression that I cannot use the contact_id attribute of brevo within an email template (to track a link, for example). Do you confirm this?

Thanks a lot,
Chloe

Hey Chloe! :blush: You’re right—Brevo’s contact_id can’t be directly used within email templates for tracking links. However, there’s a workaround that might help you set up your referral program.

What you can do is use the Brevo API or create a custom field within your contact database. This way, instead of using contact_id, you can generate unique referral codes for each contact and insert those into your email templates. Here’s a simple breakdown of how you can approach it:

  1. Create a Custom Field: Set up a new custom field (e.g., referral_code) for each contact in Brevo. This will store the unique code.

  2. Generate Unique Referral Codes: Use a script or your CRM to generate unique referral codes and assign them to each contact in Brevo.

  3. Insert Referral Code in Emails: Once you’ve assigned the referral codes, you can easily insert them into your email templates by using Brevo’s personalization feature (e.g., {{ contact.custom.referral_code }}).

This should allow you to track each contact’s referrals through a unique ID tied to their email link. If you need more help with setting it up, let me know, and I can walk you through the details!

Hi Esther,

THANKS ! You confirm what I understood; I therefore switch to my “plan B”, which is exactly the option you describe.

For step 2, what is the « cleanest » solution to generate this unique number? Can a Brevo function help me? Or do you recommend a third-party tool (which one?)

You mention « a script » ; do you think I can find a model somewhere ?

Many thanks,
Chloe

Hi Chloe! I’m glad the workaround seems like a good fit for you! :blush:

For generating unique referral codes, here are a couple of options:

  1. Using Brevo’s Built-in Features: While Brevo doesn’t have a direct feature to generate unique codes, you can use its automation and personalization features to assign unique identifiers. If you have a spreadsheet of contacts, you could generate codes in Excel (using functions like RAND() or RANDBETWEEN()) and then upload them to Brevo as custom fields.

  2. Third-Party Tools: If you’re looking for a more automated solution, you might want to check out tools like Zapier or Integromat (now called Make). They can help you create unique codes and automate the process of adding them to your Brevo contacts. For instance, you could set up a Zap that generates a unique code every time a new contact is added.

Let me know if it works or if you need help implementing this :blush: