Generic form to put users in specific segments

Good morning,

I have an online store and when a product is unavailable, I would like my users to have the possibility of registering their email so that I notify them when the product is back.

I thought about creating a segment per product and putting their user in the segment associated with the product.
I feel like we need to do one form per segment.
I haven’t found a way to make a generic form with a segment parameter that could indicate the segment to which we must add the user.

Can you confirm that this is indeed it and that I am on the right track to achieve my need?

Thank you very much

Well you can add a hidden field where a variable with the product id can be saved and add a tag or segment to the user where the tag or segment is called like the product id. This solution needs a bit of coding or if you are at woocommerce, guess you can use the CF7 plugin.

Or you can create as many forms as products you have, both ways will work.

Which cart are you using?

Thank you very much for your answer.
I think I can add a hidden field in the form.
What I don’t know how to do is receive this field by Mautic.

Normally, in Action in the form I put: “Modify contact segments” and I add the contact to the segment (as you show in the screenshot)
However, the “segment” field does not accept a variable.
It is a drop-down menu of existing segments.
So I don’t understand how my hidden field embedding my segment can be reused to designate the segment in which the contact must be put.

Hi,
The idea is that you add the tag.
Then you create a segment where the segment filter is based a contact having this tag.

1 Like

Thanks for your feedback and your ingenious idea.
In fact, I prefer to use segments because when a user gets the product (following a restocking):

  • If there is a segment per product, in the preference center, he will be able to unsubscribe only from alerts for this product.
  • If I use a segment only and tags per product, on the unsubscription in the preference center. he will unsubscribe at once from all alerts, even from products he is still looking for.

For information, I have many, many products.
I don’t mind having a segment per product because it makes sense, I think.
On the other hand, having a form per product will be unmaintainable. I really need to make it generic and for Mautic to be able to put the contact in the right segment from the hidden field… but I don’t know if it’s possible ;'(

Ok for information, I succeeded but by going through the API. So I created a form manually and a dedicated page that calls the Mautic API to create the contact in the segment. and it seems to work.
It seems impossible to do it directly in mautic

I was going to suggest the same approach:

  • Add a simple form to your product page
  • Trigger an AJAX call to your Mautic API
  • Create (or update) the contact and add it to a segment via that AJAX API call

This approach will not connect the contact with previous history, you create a brancd new contact.

The email field is a unique identifier. You can’t have two contacts that share the same email.

Mautic will update the existing contact changing only the contact fields that you provide in your request.

There’s more detail in this post about using Mautic’s API.

I’m not saying it’s a bad solution.
What I’m trying to say here is, that you’ll loose all previous tracking information.

Let’s say Anon User (id4) comes to your website and checks out a bunch of articles. Collects points, etc.

Once he has enough points, you direct him to fill out a form (DWC, Focus Item)

He fills out the form, and the API creates a new contact: ID100.

If you do this with API, the Anon user and newly created one won’t be associated.

Better to read out the cookie first, to know the Mautic ID, then you can modify the contact in Mautic with an API call.

Ah, now I’m getting what you mean.

Totally valid point (that I keep forgetting, because I don’t use the mtc.js tracking script much).