Store & Manage your email newsletter list using Google Analytics
This is a little Google Analytics hack I came up with the other day. Its not exactly a ‘robust’ solution but it might be useful for somebody!
The idea is to turn Analytics into a database for your email newsletter subscription list (or any other form where you want to collect a basic list of email addresses) .
Usually this will be done in one of three ways:
1. Integrate your web form with your CRM system– the best solution but can be tricky/ expensive to setup
2. Store the emails in a web based database then export them later – simple but requires a database and some sort of server side coding i.e. PHP
3. Send an email to yourself with the addresses each time someone signs up- pretty easy using CGI’s but can be a real pain to manage if you have a lot of subscribers.
OK, here’s how to do it-
Setup your form:
You can see a demo of this here
The basic code you want is below, all this form needs to do is link to a free text form field to a page called ‘subscribe.html’.
<title>Subscribe to the newsletter</title>
<INPUT TYPE="submit" VALUE="Subscribe!"> </FORM>
Setup your thank you page
Next you need to create a page called subscribe.html. This page will post a variable into the address bar with the email address you submit on the previous page, which will allow us to save the address in Google Analytics.
Here’s the code you need on this page. Obviously you can change the thank you message to say whatever you want and you’ll want to use your own Google Analytics tracking code, not ours!
Capture the email addresses with Google Analytics
OK so we’ve sent Google Analytics a pageview with the email address in the url so if you login to Analytics, go to ‘Content’ and ‘top content’ and filter the page name ‘subscribe.html’ you should see a list of the pages with the email addresses in the variables like you see below:
You could extract this data and remove the email addresses but to make this really simple we’re going to use Google Analytics site search tracking to filter out the addresses from the page names.
If you’re already using Google Analytics site search tracking you’ll want to setup a new profile for tracking your emails.
Configuring site search to capture the emails
This is easy. Just go to your Analytics profile settings and enable site search. Then put ’email’ in the ‘query parameters’ box.
Viewing your subscribers
Now you just need to go to your Site search report and look at ‘search terms’ and you should have a nice clean list of email subscribers. When you want to send out an email just export the search terms report as a CSV file and there’s your list!
When to use this script
I haven’t used this on any live sites and theoretically its open to abuse but if you want a really simple email signup on a site with no database this might help.