• Resolved ntel

    (@ntel)


    Hey chimps,

    Here’s a tough nut to crack for you.

    I have a WordPress blog that’s split into 100s of categories, say baseball, football, basketball, and 999 other sports for instance.

    At the bottom of each article about baseball, I display a form offering a free eBook about baseball (“10 little-known tricks in baseball”). I use “Easy Forms for MailChimp” for this form, and can code in PHP. My goal is 1) for the form submission to trigger an email with the link of the relevant eBook to the contact and 2) for my growing list to keep the information that “this contact is interested in baseball”. Simple stuff. But I struggle to find the leanest way possible to implement this.

    – Solution A would be to create 100s of different forms on my plugin (one for each sport), display the relevant form at the end of each article about a given sport, and in the Mailchimp backend, link each of these 100s of forms to hundreds of lists (or list segments). Each list or list segment would have its own email campaign.

    – Solution B would use just one form, along with the newly-available “tag” feature to tag each new subscriber according the page they subscribe from. So they are tagged “Baseball” if they came from a baseball article. Then the sending of an email would be triggered, only to new subscribers that are ALSO tagged “baseball”. On my list, they would be tagged baseball, that way I know where they came from. Lean, clean, peaceful.

    Problem is, I don’t know how to do B.
    – I don’t know how to dynamically assign a given tag to a new subscriber using the form plugins that I have at hand
    – I don’t know how to send a specific campaign ONLY to new subscribers with a specific

    Soo… I am at loss! Would greatly appreciate any help or thinking!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @ntel,

    Apologies for the delay – I was out of the office yesterday.

    I would definitely advise you to use a single MailChimp list and a single form from our plugin. That will make everything much easier.

    Unfortunately MailChimp doesn’t allow you to create subscribers with tags yet (i.e. the API only lets you read tags, not create/update them). Therefore we will need to take a different approach.

    My suggestion would be to use an interest group to hold the user’s sport interest. The benefit of this is that the same subscriber can be interested in multiple sports connected to the same list. If you used a MERGE field, you would only be able to have one interest per subscriber.

    In MailChimp, create a Checkbox interest group with all 999 sports (we’ll continue with the sport analogy). I don’t know how many fields you can have in an interest group. Hopefully it will work.

    In Easy Forms, add this interest group to your list and set it as hidden.

    Now, the final piece is to pre-select the interest group based on the current page. Unfortunately, we don’t have a perfect filter for you to use but we can make it work. I won’t write the full code here but the basic idea is to check which page you’re currently on, get the sport, and then use JavaScript to select the interest group that matches that sport. I can write this code w/ you if this is the approach you’re going to take.

    Let me know if that implementation sounds feasible to you.

    Thank you,
    Kevin.

    Thread Starter ntel

    (@ntel)

    Hi Kevin, Thank you so much for your answer, so sorry I was away on vacation.

    Thank you for your advice on:
    – not using tags
    – using one form for all interest groups

    I am willing to precreate the 999 interest groups, but I think mailchimp limits at 60 interest groups. What I can do though is to group sports together (let’s say 60 groups of 33 sports each), and just create 60 interest groups. I would pass the actual name of the sport using a merge field, so for instance baseball would go:
    * INTEREST GROUP : ‘team sports’
    * SPORT_NAME : ‘baseball’

    With this system, two questions are:
    1. How would you “use JavaScript to select the interest group that matches that sport”? I tried to look into filters here, https://yikesplugins.com/support/knowledge-base/filters/, and my best bet was to hijack the data using the “yikes-mailchimp-filter-before-submission” filter, and then add my $sport_name in the SPORT_NAME field using PHP. So far I’m failing :/

    2. My above solution obliges me to send the same freebie to all ‘team sports’. But maybe, I send subscribers to a custom URL that would be dynamically built using the “baseball” merge field. So they would be sent to mysite.com/team_sports/baseball.PDF with team_sports and baseball being taken from the form input. To that end, do you have an example of your “yikes-mailchimp-redirect-url” filter in use?

    Thank you so much!
    Ntel

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @ntel,

    I think you’re going to run into some issues with ~17 interest groups of 60 terms but I’ll explain what you would need to do in theory…

    1. Set up your interest groups in MailChimp.com and add them as hidden fields to your Easy Forms form in WordPress.

    2. Then you can use this filter to write any JavaScript you want:

    add_action( 'yikes-mailchimp-shortcode-enqueue-scripts-styles', 'easy_forms_prefill_interest_group' );
    
    function easy_forms_prefill_interest_group() {
    	?>
    	<script type="text/javascript">
    		// Fire off whenever the page is loaded.
    		jQuery( document ).ready( function() {
    			// Set value of interest group field...
    		});
    	</script>
    	<?php
    }

    The goal of the JavaScript is to find out which page you’re on (i.e. baseball) and select/check the hidden interest group checkbox/radio with the name baseball.

    I can give you more specifics if you do the first part and send me the URL to your form.

    I cannot guarantee this setup will be pretty in MailChimp…

    Cheers,
    Kevin.

    Thread Starter ntel

    (@ntel)

    Thank you Kevin, for your answer.

    It’s indeed quite a pain, unfortunately. I created step 1. as you mentioned but I’m afraid Step 2 does not apply to my specific case since Mailchimp limits the number of interest groups to 60 (I would need more differents segment + freebies than this :/).

    I’ll allow myself to answer on the other thread since this is where I have made progress so far.

    I thank you wholeheartedly for your effort!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Insert tags into forms for Mailchimp tagging’ is closed to new replies.