DynamoMTL / spree_chimpy

Spree/MailChimp Integration
BSD 3-Clause "New" or "Revised" License
35 stars 123 forks source link

Segmenting does not work as expected when using double opt-in #14

Closed johanb closed 11 years ago

johanb commented 11 years ago

I just noticed an issue with the segmenting code. Apparently Mailchimp does not allow you to segment users that have not yet confirmed their mailinglist subscription. So if you have the double opt-in enabled (where Mailchimp sends you an email to confirm the subscribtion), the user that just created an account with the store will never get segmented.

Mailchimp will return the following response in this case:

"success"=>0, "errors"=>[{"email"=>"klaas@hans.nl", "code"=>232, "msg"=>"There is no record of \"klaas@hans.nl\" in the database"}]}

There is a few ways we can tackle this:

The most robust solution would be to do option 1 + 2. Users that don't use double opt-in have no issue with this. Users that do use it, can set up a cron. The only downside would be the extra set-up for a cron but that's not such a big deal.

I'd love your feedback on this @joshnuss before I whip up a PR.

Relevant API docs: http://apidocs.mailchimp.com/api/1.3/liststaticsegmentmembersadd.func.php

joshnuss commented 11 years ago

Hey Johan,

We could also make double opt-in a config setting. That will make it easier for many users that dont need double opt-in. For those that need double opt in they can run the rake task like you suggested

what do u think?

johanb commented 11 years ago

@joshnuss sounds good to me.

joshnuss commented 11 years ago

Do you want do handle it or you can leave it for me and I'll get to it later in the week

johanb commented 11 years ago

@joshnuss was just about to get started on it.

joshnuss commented 11 years ago

perfect

On Sun, May 19, 2013 at 1:58 AM, Johan Bruning notifications@github.comwrote:

@joshnuss https://github.com/joshnuss was just about to get started on it.

— Reply to this email directly or view it on GitHubhttps://github.com/DynamoMTL/spree_chimpy/issues/14#issuecomment-18112889 .

johanb commented 11 years ago

Still WIP

johanb commented 11 years ago

@joshnuss should we really default the doublt_opt_in to false ? It would work better for the segmenting, but it goes against mailchimps default. What do you think ?

joshnuss commented 11 years ago

I believe double opt in is not required if you have a "subscribe to newsletter" checkbox on your user registration form. because the user has chosen to subscribe. will check the docs

johanb commented 11 years ago

@joshnuss it's not required. FWIW, currently double-opt-in is the default. https://github.com/DynamoMTL/spree_chimpy/blob/master/lib/spree/chimpy/interface/list.rb#L15

johanb commented 11 years ago

@joshnuss asside from making a decision on wether or not we want to have double-opt-in as a default this should be ready to merge.

johanb commented 11 years ago

So, uhm, what about this PR ? @bryanmtl @joshnuss have you decided what the default behavior should be ? other than that it's ready to merge.

joshnuss commented 11 years ago

@johanb Sorry for taking forever to get this in, this is gonna be a really useful feature. thanks!