Dynamic tags on a NationBuilder Signup Page

If you want a bit more flexibility than what’s offered by NationBuilder for tagging people on signup, dynamically adding tags from Javascript is quite straightforward.

If you examine the code for a signup page, NationBuilder just uses a hidden input element to add tags to a user when they submit the signup page.

We can use this to dynamically add tags to a signup page by inserting or altering the tag.

Where your_tag is the tag you want to add. The tags are specified by their slug, so there’s no looking up by id necessary.

A good and bad thing is that NationBuilder doesn’t validate the tags that come back when the user presses submit. This is a bad thing because typo’s will create a new tag in your database, but it’s a good thing if you want your Javascript to create new tags on the fly, there’s no need to add them to NationBuilder or configure them on the page.