0

Mailchimp has an article that explains how to track signup form locations by adding hidden fields to the mailchimp form.

screen of hidden input for signup form

All well and good, but if you put the form in a Drupal block, the location of the form suddenly becomes a variable.

I'm wondering if the token module, and a token in place of a hard-coded hidden field value that tracks location, would be a good approach? The form code for the hidden field currently looks like this:

 <input id="SIGNUP" name="SIGNUP" type="hidden" value="global" />

So, the value "global" is the one that needs to change based the the page that the block is displayed with.

I'm not sure about which token to use, but thinking I'd use something like the page title or page url. In the case of a simple block, do I just need to get and enable the token filter module?

Any thoughts on token as a good option, or other ideas I should consider?

Note - this has nothing to do with the mailchimp module (http://drupal.org/project/mailchimp), which I don't have installed on this site since this site doesn't yet have any notion of user logins.

Links: token and token_filter.

  • can you provide a link to the mailchimp article referenced? – schnippy May 4 '13 at 19:45
  • Added the link back to first sentence (got removed during an edit I think) – Dave Bruns May 4 '13 at 22:27
  • thanks for that - can you post the html code for your signup form? – schnippy May 5 '13 at 2:07
  • Edited to add the current HTML for the hidden field. Let me know if you're looking for more. – Dave Bruns May 5 '13 at 5:50
1

I'm sure there's a simple answer to the above question, but in the end I took a different approach described here: Create custom signup block with mailchimp module?

Because I'm using hook_form_submit to control processing once the form is submitted, I can add the form location (using request_path()) to the merge variables that are passed back to mailchimp. That way, the form is the same on ever page that it appears, but the location is passed back to mailchimp as part of the sign-up process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.