1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

MailChimp revisited

Discussion in 'Standard Support' started by JackGoa, May 15, 2018.

  1. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, here's where I'm confused:

    That's not how Mailchimp interest groups work. They are simple true/false. A group has an ID, and you either set that to true or false, to add or remove them to/from that group.

    Now ... categories can be checkboxes, of multiple groups. Or radio buttons with a choice of groups. But this plugin doesn't implement categories, it implements simple groups. So it looks like you are trying to do ...

    Checkbox: group1, group2, group3

    ... but in the plugin as-is, you'd have to to do that as 3 radio buttons ...

    Group 1: yes / no
    Group 2: yes / no
    Group 3: yes / no

    At some point (either if I need it for one of my sites, or someone funds the work) I may well work on allowing a category approach, so you can have a checkbox with multiple group ID's. But for now ... it's simple groups.

    -- hugh
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I did actually look at automating the whole thing, so instead of building a JSON data structure to map elements to groups, the form plugin just talks to the Mailchimp API, gets the categories and groups, and builds it's own set of checkbox, radios and dropdowns to match what the specified list has on it. So they aren't elements within the form. But that's a lot of work.

    -- hugh
     
  3. JackGoa

    JackGoa Member

    Level: Community
    I'm confused. You get Interest Groups with Interests inside the groups. Groups can be setup as radio buttons or check boxes? That's how I have it setup.
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Mailchimp's terminology is confusing. They call it one thing in the UI based docs ("groups"), and another within the API docs ("interests").

    https://developer.mailchimp.com/doc...eference/lists/interest-categories/interests/

    https://mailchimp.com/help/getting-...e=mc-api&utm_medium=docs&utm_campaign=apidocs

    At the API level, they are just simple true/false. You either add a member to an interest ID ... {"1234567":true} ... or you don't ... {"1234567",false}.

    -- hugh
     
  5. JackGoa

    JackGoa Member

    Level: Community
    I think I have it right then.
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Is it working?

    -- hugh
     
  7. JackGoa

    JackGoa Member

    Level: Community
    I did a few tests now. With the [ ] brackets, it does not update any fields in MailChimp except for name and email. Without the [ ] brackets, it goes through, but all the interests are marked and what I ticked on the form is ignored.

    This is what my options look like. these are all radio button or checkbox options.

    Code (Text):
    {"fd94816f84":"0","11aea8decf":"1","2cba142fcf":"{vs_users___gender}","3b7180d985":"{vs_users___gender}","3c2f88c336":"{vs_users___gender}","5492bc676a":"{vs_users___interested_in}","9e59892ce4":"{vs_users___interested_in}","511b96ac2b":"{vs_users___interested_in}","badd76d98c":"{vs_users___relationship_status}","b2eba1d079":"{vs_users___relationship_status}","7990dafbe7":"{vs_users___tell_me_more_about_what_you_re_interested_in_raw}","19dab217f6":"{vs_users___tell_me_more_about_what_you_re_interested_in_raw}","0de1370767":"{vs_users___tell_me_more_about_what_you_re_interested_in_raw}","be6468a694":"{vs_users___tell_me_more_about_what_you_re_interested_in_raw}","3ec6e78e04":"{vs_users___tell_me_more_about_what_you_re_interested_in_raw}"}
    Attached is a screenshot of some of the groups in MC.
     
    Last edited: Sep 5, 2018
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Try appending _raw to all the placeholders.

    As mentioned in one of my previous posts, it interprets 0 or empty as "false" and anything else as "true". Without the _raw you are probably getting the labels, not the values.

    -- hugh
     
  9. JackGoa

    JackGoa Member

    Level: Community
    Appending _raw again fills in all the options. Including the last group which is a group of checkboxes and not radio buttons.

    Quite weird to see 3 radio buttons ticked on MailChimp's side.
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I'm still hopelessly confused.

    Are you talking about "Signup Forms" in MailChimp, that let you define radio buttons, checkboxes, text fields, etc ...

    View attachment 17496

    ... or "Groups" ...

    View attachment 17497

    The latter, "Groups", is what we support. They don't have radios or checkboxes, or any UI at all. They are just groups (IDs) to which you add or remove users.

    Show me some screen captures of what you are looking at on the Mailchimp site.

    -- hugh
     
  11. JackGoa

    JackGoa Member

    Level: Community
    I'm definitely talking about groups, but MailChimp adds those to your Signup Forms anyway. When you setup a new group, it usually asks you, dropdown, radio, checkbox, etc.
     
  12. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Ah, OK, I see where the confusion is.

    We don't currently support mapping that way.

    Currently we only support simple interests. Not interest-categories.

    So for example, in their "signup form" representation, a radio is multiple group IDs, which in the API is an "interest-category". So a "Male / Female" radio maps to two separate group IDs. And the API data you have to send to Mailchimp doesn't look like ...

    <male_or_female group id>=male

    ... it looks like ...

    <male group id>=true
    <female group id>=false

    To replicate that with this plugin as-is, you would need the rather fugly ...

    Male: yes/no
    Female: yes/no

    Which would map as ...

    {"<male group id>":"yourtable___male_yesno","<female group id>"{yourtable___female_yesno}"}

    This is kinda what I was talking about before, with having the plugin query the API for your setup.

    I'll take a look when I get a few minutes.

    -- hugh
     
  13. JackGoa

    JackGoa Member

    Level: Community
    That's exactly like I have it now?
     
  14. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Not according to your JSON, where you have a single {vs_users___gender} placeholder.

    -- hugh
     
  15. JackGoa

    JackGoa Member

    Level: Community
    I have 3?

    Code (Text):
    "2cba142fcf":"{vs_users___gender}","3b7180d985":"{vs_users___gender}","3c2f88c336":"{vs_users___gender}"
    Screenshot of the group in MC attached.
     
  16. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    No, you've got one, {vs_users___gender}.

    So it's doing exactly what you are asking it to do - assign the selected value of that element to all three of the Mailchimp interest groups.

    The existing logic of the plugin is very simplistic:

    Assign an element's value, expressed as "false" (0 or empty) or "true" (anything else) to an interest ID.

    The logic you are expecting is more like ...

    For every possible value of an element (radio or checkbox), associate each value with a specific interest ID, and for each value, check whether that value is selected or not, and set the interest accordingly.

    Which is very different logic.

    As I said, I'll take a look, and see what I can come up with. I think if I extend the placeholder syntax to something like {placeholder|value}, I can do it. So your JSON would look something like ...

    "2cba142fcf":"{vs_users___gender|1}","3b7180d985":"{vs_users___gender|2}","3c2f88c336":"{vs_users___gender|3}"

    Meaning, if the elements value equals the value after the |, set that interest true.

    -- hugh
     
  17. JackGoa

    JackGoa Member

    Level: Community
    I'm lost.

    I have 3 options under "Gender". So, in MC, I have a Group called Gender with 3 Interests, Male/Female/Other.

    In Fabrik, here are those 3 options:
    "2cba142fcf":"{vs_users___gender}","3b7180d985":"{vs_users___gender}","3c2f88c336":"{vs_users___gender}"

    If a radio button is not ticked, it will return false and if it is ticked, it will return true. Correct?

    But you say I only have one option under Gender?

    And what about checkboxes as opposed to radio buttons? They don't seem to work either.
     
  18. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Try re-reading everything I've been saying. I can't think of any way to explain it better.

    TL/DR ... The plugin currently won't do what you are expecting it to be able to do.

    I need to add some more features and code.

    -- hugh
     
  19. JackGoa

    JackGoa Member

    Level: Community
    I still don't understand what I'm doing wrong? I can't see what other purpose this part of the plugin serves other than what I am trying to get it to do?
     
  20. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I wrote the plugin to meet the needs I had for it, which didn't involve signup forms and interest categories. Just simple interest ID's, with a true/false (in my case it was categorizing types of user, behind the scenes, according to their user group, no UI involved). I've never used signup forms in Mailchimp.

    However ...

    https://github.com/Fabrik/fabrik/commit/35479c9a1b82dc42444379c4e973876ea9276e26

    ... should give you what you need. You need to extend your JSON like this:

    Code (Text):

    {
        "58d1ec4980": true,
        "58d1ec4981": "{fab_mailchimp_test___color_raw|blue}",
        "3b87665864": "{fab_mailchimp_test___color_raw|green}",
        "897f59c2ee": "{fab_mailchimp_test___color_raw|red}",
        "decb7bef51": "{fab_mailchimp_test___cars_raw|ford}",
        "20b6456536": "{fab_mailchimp_test___cars_raw|ferrari}"
    }
     
    That's a working example from my test case.

    The first ID (58d1ec4980) is automatically setting a simple interest ID to true.

    The next two are for a "Favorite Color" radio, created in the Signup Form, which has values 'red', 'green' and 'blue' (and each value has a matching interest ID). That matches a radiobutton element in my form, which also has values red, green and blue.

    The last two are for a "Cars" checkbox, with 'ford' and 'ferrari'.

    So ... basically, for radios and checkboxes, you add multiple lines for the Fabrik element, with |value appended to the placeholder name, matching the element's possible value(s) to the interest(s). The plugin then looks at what the submitted value(s) are, and sets the corresponding interest true or false accordingly.

    So in your case, the gender one would be ...

    Code (Text):

    {
       "2cba142fcf":"{vs_users___gender_raw|male}",
       "3b7180d985":"{vs_users___gender_raw|female}",
       "3c2f88c336":"{vs_users___gender_raw|other}"
    }
     
    Replace male, female and other with whatever values your radiobutton element has, to match the corresponding interest ID.

    Note that they don't have to exactly match. Your values in Mailchimp might be "Male", "Female" and "Prefer Not To Say", and your radiobutton values might be 1,2,3 or male,female,other ... you just have to match the Fabrik value to the interest ID.

    Also note the _raw appended to the name, and that I'm tlaking about the radiobutton option values, not the labels.

    -- hugh
     

Share This Page