Reputation: 3924
I need to know how and if it is possible to automatically add tags to an audience when we use an embedded form. Right now MailChimp allows you to use their "Landing Page" option and select up to 5 tags.
I was directed to the MailChimp Developers section because their technical support could not help me.
Is there a query string I can pass to the URL? Is there something in a JS widget I can add as a parameter or am I going to have to use the API to do all of this?
Upvotes: 3
Views: 5563
Reputation: 57
The network call https://us8.admin.mailchimp.com/audience/tags/lazy
that happens when you bring up the tags view has a json blob in the reponse containing your tag ids:
...
"tags": {
"pageData": [
{
"id": 0000, <- this thing is what you want
"whitelist_name": "",
"list_id": 0000,
"name": "tagname",
"type": "static",
"typeDescription": "Static",
"createdDate": "Aug 11, 2023",
"updatedDate": "Aug 11, 2023",
"status": "finished"
},
I create the post url. It contains the action (the generated url for your audience), the name and email, and a hardcoded (or consider making checkboxes) list of tag ids.
static createMailChimpSignupPostUrl(action:string, firstName: string, email: string, tags: Array<number>) {
var path = `${action}&FNAME=${encodeURIComponent(firstName)}&EMAIL=${encodeURIComponent(email)}`;
if (tags.length > 0) {
path = path + `&tags=${encodeURIComponent(tags.toString())}`
}
return path.replace('/post?', '/post-json?');
}
Just tested it and got the tags to show. Make sure you capitalize tags like tags
and fname like FNAME
.
Hope that helps, cheers.
Upvotes: 1
Reputation: 3261
If you create an embedded form in Mailchimp you are able to select tags - as many as you want. You can then copy and paste that code onto your website and capture signups, with tags, without having to use the API.
See the instructions here: https://mailchimp.com/help/add-a-signup-form-to-your-website/
Looking at the code generated by the embedded form you need to specify a hidden HTML tag using the id of the mailchimp audience's tag.
<div hidden="true"><input type="hidden" name="tags" value="2280"></div>
I think you'd need to use the embedded form builder to determine the tag ids because I don't see them displayed in the UI or URL (unfortunately).
Go to Audience -> Signup Forms -> Embedded Forms
Upvotes: 1
Reputation: 19
Try advance forms in mailchimp and add the tag, that you would like to assign to new subscribers
Upvotes: 0