Open JamesChevalier opened 9 years ago
I found that when I updated new_count = referring_member['merges']['RCOUNT'].to_i + 1
I could never go above 1 in my list so I also updated the following: mailchimp.lists.update_member("#{MAILCHIMP_LIST_ID}", {'euid' => "#{referring_member['id']}"}, 'RCOUNT' => "1") to mailchimp.lists.update_member("#{MAILCHIMP_LIST_ID}", {'euid' => "#{referring_member['id']}"}, 'RCOUNT' => new_count)
As for the second part, I'm not too concerned if that is the case - but it did have me wondering, is there a way to track who has referred who?
Well I added a mail merge field 'SIGNUPS', then added this line: new_member = referring_member['merges']['SIGNUPS'] + email + ","
And updated this line: mailchimp.lists.update_member("#{MAILCHIMP_LIST_ID}", {'euid' => "#{referring_member['id']}"}, 'RCOUNT' => new_count, 'SIGNUPS' => new_member)
And now I just feel silly considering mailchimp limits fields to 255 chars and this is not very robust...
Received three emails:
Hello James, I tried your launch soon project, and found some problem with the mailchimp api. When i try to subscribe reffered user, there is problem in updating the referral. It is not working even on your demo app, so i think it is problem of the mailchimp api.
Could you please update it? Thank you.
web ... http://launch-soon-example.herokuapp.com/
user come with ref ... http://launch-soon-example.herokuapp.com/?ref=6744cfdc9f5b3f934d1b4d4d7ec97697
problem message: There was a problem updating the referral at MailChimp
i think that i found the solution, there was not a conversion from string to integer, so it was unable to increment
new_count = referring_member['merges']['RCOUNT'] + 1
changed tonew_count = referring_member['merges']['RCOUNT'].to_i + 1
Mailchimp needs to have double opt-in and if new user is created and not confirmed, refferal cannot be found. I found a solution by turning double_optin to false, so users do not need to confirm subscription.