How to Collect Email Leads from Twitter in a Google Spreadsheet
One of the best features of Twitter that is relatively unknown to most users is their Lead Generation cards. Your tweet, see live example, will have a button and when another Twitter user clicks the button, their email address is sent to your application (which happens to be a Google spreadsheet in this case).
Whether you are a small website owner or an event organizer, you can use these Lead Generation cards to easily collect email addresses from Twitter users who may be interested in your product. For instance, Twitter users can subscribe to your email newsletter with a click without leaving the Twitter website. Event organizers can use Twitter’s Lead Generation Cards to capture email addresses of people who may be interested in attending an upcoming event.
Twitter Email Leads
Integrate Twitter Lead Generation Cards with Google Sheets
The Lead Generation Cards are available to all Twitter users who have a Twitter Ads account - get yours at ads.twitter.com - and there are no costs involved. This tutorial explains how you can create a Twitter Lead generation card and capture all the email addresses in a Google Spreadsheet. Other than the email address, the screen name and the full name of the Twitter user is also collected in the spreadsheet. Let’s get started:
1. Prepare the Google Spreadsheet
The first thing we need to do is create a Google Spreadsheet that will be used to store the details of Twitter users. This sheet will internally contain a Google Script to connect the sheet and your Twitter card.
This is easy. Click here to make a copy of the Google Sheet in your Google Drive. Once the copy is created, go to the Tools menu in the sheet and choose Script Editor. Here choose Start from the Run menu and follow the wizard to authorize the script. Next choose Deploy Web App from the Publish menu.
On the Deploy screen (see the screenshot above), click the Save New Version button and change the access permission from Only Myself to Anyone, even anonymous. Click the Deploy button and you’ll get a script URL that you should note down somewhere as we’ll require it in the next step.
2. Create the Twitter Card for Email Leads
Go to your Twitter Ads dashboard, click on Creatives in the navigation bar and choose Cards. Here click the big blue “Create Lead Generation Card” to create a new Twitter Card. You can add a description to your card, upload a 800x200 pixel image that will show up with the tweet and give your button a name (Call to Action).
Next expand the Data Settings group and paste the Google Script App URL (that you generated in the previous step) in the Submit URL field. Choose the HTTP method as POST from the drop-down, agree to the terms and hit submit to create your first Twitter card.
That’s it. You can put the Card’s URL - see example - in a tweet and your Twitter followers will be able to share their email address with a click that is directly saved in your Google Sheet.
Also see: Save #Hashtag Tweets in Google Sheets
If you are web developer, you can further enhance the Google Script to do even more advanced stuff. For instance, if you have published a premium PDF report, you can allow Twitter users to download the report after they choose to share their email address. The script will trigger as soon as someone submits the email address and it will send a mail to the user with the PDF attachment using the Gmail API.
Amit Agarwal
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.
Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory