Capturing subscribers from an existing form

We’ve made it very simple to create a form on your web site where new subscribers can sign up to your list (we provide the code, you just have to copy and paste).

But what about when you’ve already got a form, and you simply want to add a checkbox where customers can opt-in to your newsletter? This isn’t quite a copy and paste job, but it’s not far off.

Lets take a look at a simple example. Your site has a ‘Contact Us’ form, which sends you an email with the details of a customer enquiry. You've just decided to add a little ‘Subscribe to our newsletter’ checkbox. How are you going to integrate this with Promotion? Here’s a few ways:

1. Use an extension or plugging

This is the simplest of all if you happen to be using a suitable CMS or shopping cart. We’Ave got a bunch of downloadable plug ins, extensions and modules for systems like Expression Engine, Jolla and Foxy Cart.

Over on the right of this page you’All see direct links to some of them. Check there first because it may be someone has already done the hard work for you.

2. Using the API

Lots of you already know about (and use) the API, and this is the obvious way you can achieve this. In our example, when a user submits the contact form on your web site, your already going to have some code in place to gather the contents of the form. We just need to make a slight addition to this.

Using your programming language of choice you can check to see if the user has checked the ‘Subscribe to our newsletter’ checkbox, and if they have, make a call to our API to save this person to your subscriber list. And don’t worry if they’re already in there - we won’t add them twice.

3. Redirecting to specific URL’s

If your not too keen on the idea of calling our API, there’s another method you can use, which works by redirecting to a URL on our server which will save the user to the list, then send them back to your server.

So just like before, you gather the contents of your form. Now, to get the users name and email address into Promotion, we need to redirect the user to a specific URL.

What's this redirect stuff you keep mentioning? All server side languages should have an easy way to send the user to another URL. In PHP you would use something like:

header( "Location: http://www.urlhere.com" );
and in ASP.NET it would look like
Response.Redirect("http://www.urlhere.com").

So let’s get down to specifics. The URL that we need to send the user to, is the same URL that we use in the Create a Subscribe Form code. Check out this code and you’ll see something like:

<form action="http://myclient.thisapp.com/p/a/t/tos/" method="post">.

The action URL is what we’re after, so in this case

http://myclient.thisapp.com/p/a/t/tos/.

We’re almost done, but when we redirect the user to the URL we need to include their email address (and optional name). We do this by adding them to the URL in a format like this:

?cm-4841-4841=sample@test.com&name=Joe+Bloggs.

So the full code in PHP would be

header( "Location: http://myclient.thisapp.com/p/a/t/tos/
?cm-4841-4841=sample@test.com&name=Joe+Bloggs" );.

The important points to note are the question mark (?) to show the start of the variables, the ampersand (&) to separate the values we’re passing in, and the plus sign (+) which should be used to replace any spaces in the name.

Of course, you’ll need to grab the name and address values from your existing form, and plug those in where we have sample@test.com for example.

When the user is redirected to the above URL, they will be added to your list, but what happens next? Well, hopefully you’ve added a custom subscribe page (and if you haven’t, just jump into the “Create a Subscribe Form” options in your list and add one), and the user will be redirected back to the subscribe confirmation page you’ve specified.

The best part is, both of these approaches happen so quickly the user won’t notice a thing.


Try it for free!


top

Contact UsAnti-Spam PolicyTerms of UsePrivacy PolicySitemap

Bookmark and Share