junk mail only

How to Integrate AWeber and WordPress Registration – Without a Plugin

I thought I’d share how to do this since it’s something that ANYONE using WordPress could and probably should be doing if they’ve got any business savvy.

Basically our goal here is to give users an option to join our e-mail list when they register for our website. Sounds simple enough, right?

On the Prowl

I initially tried searching for a simple plugin to “git er dun,” but only two legitimate-looking results came up: AWeber Registration Integration (ARI) and Aweber WordPress Plugin (AWP)

Neither plugin has been updated since 2009 (which makes them near-ancient at this point, technologically speaking), but I thought I’d give them both a whirl and see what would happen.

AWP wouldn’t even install, so that was an easy cross-off my long list of options. On to ARI!

ARI sort of worked. At times I was able to get it functioning, then other times it seemed to stop working. It also comes packed with this extra feature that monitors which of your registered users elected to opt-in to your e-mail list. It’s sort of pointless to track that natively in WordPress in my not-so-humble opinion, since you can track all of that in AWeber (and most likely any other e-mail software).

Since I’m a such a perfectionist and I don’t like using plugins if I don’t have to, I decided to delve into the code of ARI and figure out exactly how it worked. Here’s the basic gist…

How it Works

Normally when you want somebody to sign up for your e-mail list, you have them fill out a form which includes name and e-mail input fields. I didn’t realize this until took a closer look at one of those forms, but basically all that happens when somebody clicks “submit” is that a unique URL is generated containing their name, e-mail, and some other parameters.

In essence, clicking submit is like clicking a URL they literally just created on the spot by filling out their name and e-mail. This is how somebody gets added to your list.

I personally use AWeber for all my e-mail lists since it’s easy to manage and it flat-out WORKS. Conveniently, they have a whole webpage explaining all the parameters you need for generating their “add-user-to-list” URLs.

So for example, this URL would add a user with the name Fred and e-mail fred@email.com to our hotleads e-mail list:


It’s honestly pretty simple once you break it down. It’s really just an “add lead” URL with some parameters to tell the software who to add to which list.

Getting back to the WordPress registration…

Connecting the Dots

Knowing what we now know about how new leads our added to AWeber, all we need to do is pass along a couple variables (name and e-mail) from our WordPress registration form to generate the add lead URL.

Once we have the proper URL in place, only one problem remains: How do we “click” it?

Meaning that we need some way to have the add lead URL placed in a virtual browser and clicked so that it executes the add lead function. You catch my drift? Just generating the URL does nothing; it needs to be “clicked.”

Luckily I’ve fooled around with web scraping (pulling data from external websites) for PkmnCards, so I knew it would be a pretty simple job with cURL. It basically mimics a user visiting a link (which is exactly what we’ve got to do here).

I looked back through the ARI code again and realized that this is precisely how it works, but for some reason the code is a lot more complex than I could comprehend. I’m not exactly sure why it does some of the things it does.

Anyway, I was able to pull out bits and pieces from the ARI code to help build my own functions. The biggest thing it helped with is making sure I was using the right WordPress hooks.

The Code

So without any further adieu, here’s the complete code (which you can plop in your theme’s functions.php):


(Take a look at the full thing then come back here and I’ll break it down for you.)


A couple notes…

1. First, we add First Name and Last Name fields to the default WordPress registration form. You don’t have to do this, but I like to get a user’s full name since it can be pretty powerful to have that in your system.

Think of how nice it would be to customize a sales page on your website if you had the prospect’s full name… I know you could REALLY grab my attention with a headline like…

“Why Adam Capriola is Failing”

Or you could do something as simple as say “Welcome back, Adam!” after I log in. Small customizations like that can go a long way. Sure, maybe a couple less people will register for your site because they don’t want to take 5 extra seconds to type out that info (or maybe they don’t want to share it), but I think the leverage you gain is well worth a few less leads.

2. The code after the extra fields checks to make sure the user actually entered their first and last name, and then it saves that info to their profile.

Pretty simple:

If you were saving a custom data field to the user’s profile, you could need to save it like this:

update_usermeta( $user_id, 'CUSTOM_DATA', $_POST['CUSTOM_DATA'] );

A little more on that in a minute…

3. Finally we get to the good stuff… first we insert an opt-in checkbox so the user can decide whether or not they want to subscribe to our e-mail list. I have it checked by default via checked="checked", but you don’t have to do that if you don’t want. I think it’s smart to do that though.

If you want to be really on top of your stuff, you could try and get even more info from the user and add them to a segmented list. For example, you could have them select their country, and create conditional statement for the next part of code to add them to a specific list.

Or ask for their gender… favorite food… stuff like that. Any info you can gather to send them specified e-mails is valuable. Think of how much information Facebook and Google try to gather and then market back to you. This information can then be saved to the user’s profile via update_usermeta( $user_id, 'CUSTOM_DATA', $_POST['CUSTOM_DATA'] ); which I mentioned earlier.

4. Lastly, we check to make sure the user opted-in to our list, then we build the “add lead” URL and “click” it with CURL. I will admit it’s not the perfect cURL code as I was running multi-cURL for another project and didn’t feel like changing it back to singular cURL. This shouldn’t have any effect on performance, but feel free to edit if you want.

IMPORTANT: Make sure to change $listname and $adtracking to suit your needs.

Again, you could customize this by adding conditionals and multiple lists depending on what kind of information you ask the user during registration.

Bonus Tip!

What I would do if you’re using AWeber is to create a main list, which we’ll call mainlist, and then sublists, which we’ll call sublist1 and sublist2. You will want to add users to either sublist1 or sublist2 depending on whatever conditionals you make, but then I’d also add them to mainlist via AWeber automation tools.

This way you have a “master list” with all your leads, but also the targeted lists. You could alternatively just have 1 list and then create segments via AWeber custom fields, but I find it simpler to have separate lists. You gain a little more flexibility with lists and can do some cool things with them.

Another Bonus Tip!

You could also probably adapt this to get leads if someone comments on your site. I don’t know the proper hooks, but I’m sure it’s pretty simple to add a “Join my list!” checkbox to your commenting form (just like we do for the WordPress registration form here).


Anyway, I ain’t no perfect coder, so let me know if you see any mistakes or have any suggestions. This is pretty powerful stuff and I’m surprised it isn’t more well-known or used.

Catch you on the flip,


  • http://iki.fi/dst/ OlliS

    Adam, thanks for this – looks like the exact thing I need right now. One question, though: how would you feed multiple urls to multi-curl? Let’s say we keep first_name and last_name in place but want to loop through a bunch of listnames. 
    Do we just create as many $chFOO variables as we need and then call curl_multi_add_handle($mh, $ch1, $ch2, $ch3); and so on?

  • http://adamcap.com/ Adam Capriola

    Hey Ollis! Yes… sorta. You make as many $chFOO variables as you need, then for each instance above where I have use $ch1, you need to duplicate it and add in the $chFOO.

    So like you’d need: 

    curl_setopt_array( $ch1, $options );
    curl_setopt_array( $ch2, $options );
    curl_setopt_array( $ch3, $options );


    curl_multi_add_handle($mh, $ch1);
    curl_multi_add_handle($mh, $ch2);
    curl_multi_add_handle($mh, $ch3);

    etc… each spot where I use $ch1, copy it.

  • Anonymous

    Adam, I added the full code at the very end of my functions.php and when I click update file I get a server error. any thoughts? hope i can get this to work as its exactly what i am looking for.

  • Anonymous

    Adam, is there any way to get help with whatever is going on. thanks, ray

  • http://adamcap.com/ Adam Capriola

    I don’t have time to test this out again (last time I ran the code it worked), but here’s what here’s what’s most recently saved in my files: https://gist.github.com/1866050

    Edit line 43 to include your list name and it should be good.

  • Anonymous

    Adam, i did edit line 43 and added my aweber list name and I can see the function working with the new check box. the WP registration is ok, however, I don’t get any aweber entry. besides setup my aweber list do i have to do anything else there?

  • http://adamcap.com/ Adam Capriola

    You have to give it some time; Aweber doesn’t updated immediately. Try registering with a few different personal e-mail addresses and it should eventually start working.

  • Anonymous

    I have had an aweber account for years with many names and lists. Usually a new name is updated within minutes but now its been 3 hours. i have tried a new list and an existing list, neither registered a new name. ill keep playing with it. if you think of anything let me know please. i know it should just work but for some reason it is not. i am using WP 3.3.1

  • http://adamcap.com/ Adam Capriola

    Updated the gist, I forgot to copy the first part over: https://gist.github.com/1866050

    Maybe try uncommenting line 144. If you want me to take a real serious look at it though, I’ll need a donation.

  • Andrew Pollock

    I see where we add our list name but don’t we have to specify our aWeber account somewhere. Surely more than one person might use the same listname?
    Also if we don’t need any ad tracking can we just leave that variable alone?

  • http://adamcap.com/ Adam Capriola

    AWeber only has unique list names. You’ll notice when you create a new list, you can’t just choose any name you want (most are taken already).

    And yes, you can ignore the tracking if you don’t need it.

  • joecap1


    I have the code opened in notepad….I am looking to find where I can enter my list id information….you mentioned line 43….

    What am I missing?

    Also, where in my functions.php do I enter the code?

    Great work!

  • http://adamcap.com/ Adam Capriola

    Sorry! Line 106. I added some code that was missing originally to the beginning. I’ll try to eventually turn this into a plugin so it’s easier to install.

    And you can stick it at the end of your functions.php file, after the last “}” and before the closing “?>”

  • http://www.facebook.com/customwebdesign Valik Rudd

    Hey Adam, where’s the share buttons? I want to share this on FB and don’t see any lazy way to do this, gonna have to do this manually. Thanks for this article, great stuff man!

  • http://adamcap.com/ Adam Capriola

    Heh, I’m not a fan of the buttons since they slow down load times. Glad you found the post helpful!

  • Christi Brendlinger

    Thank you for this terrific article. I was able to tweak it just a little bit and integrate AWeber with the WP-Members plugin. Totally awesome! Saved me.

  • http://adamcap.com/ Adam Capriola

    Excellent! I’m happy to hear that.

  • Felice Yeow

    Christi, may I know how you integrate AWeber with the WP-Members plugin? I’m tweaking the code but my test user is still not added to the list. Please let me know… felice.yeow@gmail.com Thanks!

  • Sofia Pinto

    Hi Christi, i need to know how you integrate AWeber with WP-Members plugin. I could be really grateful: please let me know!! pintosofia02[at]yahoo.it

  • tushar

    Dear adam sir…. please help me
    aweber url is not working with curl or file function but if i cope the url and paste it into address baar its working and through curl its giving the message invalid email id.

  • http://www.facebook.com/MisoRohac Miso Rohac

    Hi Adam…thanks for sharing this great post…I managed it to work with AWeber, however I have a little problem with the email that is supposed to be sent with the password. I receive all the emails from AWeber, but no emial about the password. What am I missing? thx

  • Authr

    Nice. Simple. Problem. I ran into a problem after the first few subscribers were successfully signed up. Error: “Too many subscribers from your computer”.

    CURL passes the server’s IP and AWeber is tracking IP for each registration. Any ideas on getting around this? I was thinking about a javascript-CURL type post so as to pass the clients IP. I found a script called curl.js but haven’t really looked into it yet. Thoughts?

  • http://about.me/adamcapriola Adam Capriola

    I haven’t tinkered with this is a long time, but maybe you could generate a random number (IP address) to pass into the CURL options? I’m not sure which variable you’d need to set though.

  • http://about.me/adamcapriola Adam Capriola

    That is something WordPress is supposed to send, right? Check your WordPress settings and possibly your spam folder. Also remove my code and register with a clean install to see if it send you the email.

  • Khursida Abedin Ani

    Really nice post. Bub I want to add gender option in registration page my website http://w3datingsite.com . how to it ? Thanks

  • Pingback: błyszczyki do ust

  • Pingback: pawn shops near me that buy electronics