Introduction
Driving traffic to your website is obviously an important piece of the equation for any online business. Converting that traffic into sales is the primary goal, of course, however, there are other sorts of conversions that can be considered a success as well.
- Mailing List Signup – Data shows that mailing lists are an important aspect of today’s marketing strategies.
- Phone Calls – It’s always nice when potential customers pick up the phone and call.
- Social Network Distributions – Facebook Likes, Twitter Tweets, and the like are always welcomed events.
Various tactics have been used to produce conversions in these areas. For example, you might give away a free eBook with information about your product or service, but in order to get the eBook users must sign up for your mailing list. This technique is being utilized all over the web today, and I’d be surprised if you haven’t seen it.
In this article I’m going to cover a different technique you might be interested in trying: Easter Eggs. We’ll utilize PayPal Adaptive Payments to add a twist on the idea in hopes of driving even more traffic to our web site.
What is an Easter Egg?
An Easter egg, in the virtual sense, is simply an intentionally hidden “thing” inside a website, a piece of software, a mobile application, a TV commercial, radio ad, etc.
For example, there could be an Easter egg hidden on a website so that when a user hovers over a particular word on a page it would automatically trigger a song to be played in the background. Or, a popup window might be triggered if a user visits 20 pages on the website. There are pretty much an endless number of possible things you could do and call it an Easter egg. With enough traffic, somebody will eventually stumble upon it.
Ticket Contest Example
Before we get into the details of how and why we’ll use PayPal Adaptive Payments, I’d like to cover an Easter egg example that I recently did on my USBSwiper website.
This was about a month ago now, prior to opening day in the NFL. I’m in Kansas City, and a long time Chiefs fan and season ticket holder. I had a couple of extra tickets to the opening day game and there was quite a bit of excitement about the upcoming season. Unfortunately, anybody who follows the NFL knows that we quickly became the laughing stock of the league, but that’s beside the point!
I decided to run a contest to give away the extra tickets and try to generate some traffic to my website at the same time.
I created an “Easter egg” on my website so that when a user would hover over a particular word on a particular page it would automatically trigger the winning event and notify the user and myself accordingly. It also immediately removed the “Easter egg” so that no other user would find it.
At this point I simply posted on Facebook and on a couple of Chiefs fan forum sites with information about when I would be launching the contest and what exactly it consisted of. The results were amazing.
While the traffic wasn’t targeted, we smashed our daily visitor average, our bounce rate dropped, and Google Analytics data shows that we also generated sales from traffic that was originally there for the contest. On top of that, we got a bunch of Facebook Likes and received a bunch of “I’ll remember this when I need it” sort of emails in response to the contest. Of course, the winner was ecstatic as well.
My only problem at this point is that I don’t have any more extra tickets or anything to give away, and that’s what leads me into using Adaptive Payments to setup a similar scenario and accomplish multiple goals.
PayPal Adaptive Payments and Cash Giveaway Easter Egg
I decided that a cash giveaway would be the best way to continue running similar contests without any actual physical prize like tickets. Of course, you could always give away a product or service time as part of the contest if you’d like to, but I’m going to stick with the cash idea for now. Who wouldn’t like to win a fresh Benjamin!?
The basic idea behind this plan will be as follows.
- $100 instant cash giveaway to whoever finds the Easter egg.
- We’ll use the same technique I mentioned previously of hiding the Easter egg on a random word on a random page through-out the site.
- In order to receive details about the Easter egg launch date/time and receive your instant cash payment (should you win) users must sign up for the contest. This will allow us to collect contact information just like a free eBook something similar would.
- Details will be sent to our entire mailing list (which now includes all of the new signups) and the contest will launch accordingly.
- As soon as somebody discovers the Easter egg an event will be triggered to…
- Use PayPal Pay to submit an automatic payment to the winner using the email address they provided during signup.
- Email the winner and the site owner a winning notification that includes payment details.
- Disable the Easter egg so no additional winners can occur (optional).
I’ll be focusing on the PayPal portion of this solution, and as usual, I will be using my PHP Library for PayPal to build the API calls and interact with PayPal’s web services.
First, you’ll want to create a basic signup form that includes the user’s name, email address, maybe a phone number and any other information you’d like to collect. You can save this data in your general mailing list like you would any other generated lead. I’ll leave this up to you as it’s pretty standard stuff and outside of the scope of this article.
I also like to save a cookie on the client-side so that I can completely automate the payment if that user finds that Easter egg. In PHP, I would use the following simple snippet to do so within my form processing code:
<?php $_COOKIE['EasterEggWinnerEmailAddress'] = $_POST['EmailAddress']; ?>
As I mentioned previously, we’ll be adding a trigger to the rollover event of a particular word on a particular page. This can be any word (or object, for that matter) and we’ll do this with a very simple javascript. Consider the following sample:
<div id="EasterEgg" onmouseover="location.href='http://www.domain.com/easter-egg-processor.php"> Easter Egg Content </div>
This simply wraps whatever you have in “Easter Egg Content” in an HTML div and sets up an automatic redirect to our easter-egg-processor.php page when a user moves the mouse over this phrase. This could also be done with some more jQuery or general javascript to make AJAX calls instead of redirects, but again, that’s beyond the scope of this particular document so we’ll keep it simple here.
The easter-egg-processor.php page will be a simple HTML form with some PHP at the top to handle the winning data accordingly. Let’s take a look:
<?php // Check if cookie exists. If so, use that value and redirect to pay.php // Otherwise, go ahead and display the form. if(isset($_COOKIE['EasterEggWinnerEmailAddress']) && $_COOKIE['EasterEggWinnerEmailAddress'] != '') { $_SESSION['EasterEggWinnerEmailAddress'] = $_COOKIE['EasterEggWinnerEmailAddress']; header('Location: pay.php'); exit(); } // Check if form was posted and proceed accordingly. if(isset($_POST['EmailAddress'])){ $_SESSION['EasterEggWinnerEmailAddress'] = $_POST['EmailAddress']; $_SESSION['EasterEggWinnerName'] = $_POST['Name']; header('Location: pay.php'); exit(); } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="WinnerInfo" name="WinnerInfo" method="post" action="pay.php"> <p> <label for="Name"></label> Name: <input type="text" name="Name" id="Name" /> </p> <p> Email: <label for="EmailAddress"></label> <input type="text" name="EmailAddress" id="EmailAddress" /> </p> <p> <input type="submit" name="submit" id="submit" value="Submit" /> </p> </form> </body> </html>
You’ll notice at the very top of this page we have some PHP code to check for an existing cookie that was set when the user initially signed up for the contest. If the cookie is found, that email will be loaded into $_SESSION[‘EasterEggWinnerEmailAddress’] and used within the API request accordingly.
If the cookie is not found, a basic form with a Name and Email Address will be displayed on screen. You’ll want to present clear instructions to the user that the email must match their PayPal account email in order to receive their payment.
Once the form is posted, the second snippet of PHP at the top of the page would be triggered to save the data to session variables and redirect to the payment processing page.
Finally, we’ve reached the magic of PayPal Adaptive Payments. At this point we know the email address of the winner one way or another (cookie or form entry) so all we need to do is build an API call to PayPal’s Pay() service. Let’s take a look at how that’s done using my PayPal PHP Library.
<?php // Part 1 – Load sessions and include the Angell EYE PayPal class library if(!session_id()) session_start(); require_once($_SERVER['DOCUMENT_ROOT'].'/paypal/class/includes/config.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/paypal/class/includes/paypal.class.php'); // Part 2 – Set cash giveaway amount and sender email account. $GiveawayAmount = 100; $SenderEmailAddress = 'sandbo_1215254764_biz@angelleye.com'; // Part 3 – Setup the PayPal object. $PayPalConfig = array( 'Sandbox' => $sandbox, 'APIVersion' => $api_version, 'ApplicationID' => $application_id, 'DeveloperAccountEmail' => $developer_account_email, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature ); $PayPal = new PayPal_Adaptive($PayPalConfig); // Part 4 – Setup PayPal request data. $PayRequestFields = array( 'ActionType' => 'PAY', // Required. Whether the request pays the receiver or whether the request is set up to create a payment request, but not fulfill the payment until the ExecutePayment is called. Values are: PAY, CREATE, PAY_PRIMARY 'CancelURL' => $domain.'paypal-cancel.php', // Required. The URL to which the sender's browser is redirected if the sender cancels the approval for the payment after logging in to paypal.com. 1024 char max. 'CurrencyCode' => 'USD', // Required. 3 character currency code. 'FeesPayer' => '', // The payer of the fees. Values are: SENDER, PRIMARYRECEIVER, EACHRECEIVER, SECONDARYONLY 'IPNNotificationURL' => $domain.'paypal-ipn-listener.php', // The URL to which you want all IPN messages for this payment to be sent. 1024 char max. 'Memo' => '', // A note associated with the payment (text, not HTML). 1000 char max 'Pin' => '', // The sener's personal id number, which was specified when the sender signed up for the preapproval 'PreapprovalKey' => '', // The key associated with a preapproval for this payment. The preapproval is required if this is a preapproved payment. 'ReturnURL' => $domain.'paypal-return.php', // Required. The URL to which the sener's browser is redirected after approvaing a payment on paypal.com. 1024 char max. 'ReverseAllParallelPaymentsOnError' => '', // Whether to reverse paralel payments if an error occurs with a payment. Values are: TRUE, FALSE 'SenderEmail' => $SenderEmailAddress, // Sender's email address. 127 char max. 'TrackingID' => '' // Unique ID that you specify to track the payment. 127 char max. ); $ClientDetailsFields = array( 'CustomerID' => '', // Your ID for the sender 127 char max. 'CustomerType' => '', // Your ID of the type of customer. 127 char max. 'GeoLocation' => '', // Sender's geographic location 'Model' => '', // A sub-identification of the application. 127 char max. 'PartnerName' => '' // Your organization's name or ID ); $FundingTypes = array('ECHECK', 'BALANCE', 'CREDITCARD'); $Receivers = array(); $Receiver = array( 'Amount' => number_format($GiveawayAmount,2), // Required. Amount to be paid to the receiver. 'Email' => $_SESSION['EasterEggWinnerEmailAddress'], // Receiver's email address. 127 char max. 'InvoiceID' => '', // The invoice number for the payment. 127 char max. 'PaymentType' => '', // Transaction type. Values are: GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS 'PaymentSubType' => '', // The transaction subtype for the payment. 'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), // Receiver's phone number. Numbers only. 'Primary' => '' // Whether this receiver is the primary receiver. Values are: TRUE, FALSE ); array_push($Receivers,$Receiver); $SenderIdentifierFields = array( 'UseCredentials' => '' // If TRUE, use credentials to identify the sender. Default is false. ); $AccountIdentifierFields = array( 'Email' => '', // Sender's email address. 127 char max. 'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '') // Sender's phone number. Numbers only. ); // Part 5 – Setup nested array with all request data to pass into PayPal class library. $PayPalRequest = array( 'PayRequestFields' => $PayRequestFields, 'ClientDetailsFields' => $ClientDetailsFields, 'FundingTypes' => $FundingTypes, 'Receivers' => $Receivers, 'SenderIdentifierFields' => $SenderIdentifierFields, 'AccountIdentifierFields' => $AccountIdentifierFields ); // Part 6 – Send request to PayPal and handle response accordingly. $PayPalResult = $PayPal->Pay($PayPalRequest); if(strtoupper($PayPalResult['Ack']) != 'SUCCESS' && strtoupper($PayPalResult['Ack']) != 'SUCCESSWITHWARNING') { // Fail. Redirect to error page and provide instructions to the winner. $_SESSION['PayPalErrors'] = $PayPalResult['Errors']; header('Location: error.php'); exit(); } else { // Success! Payment has been completed automatically! Redirect to a thank you page and display payment info. $_SESSION['PayPalPayKey'] = $PayPalResult['PayKey']; header('Location: success.php'); } ?>
Part 1
In part one of the code on this page we’re simply adding the required library files in order to generate and process the payment request.
Part 2
This section is nothing more than setting the value for the winning amount to be paid. This can be a static value, like I have it in this sample, or you could pull this from a database if you choose. We are also setting the sender’s email address here, which matches the sender account I’m using for testing in the PayPal sandbox.
Part 3
Here, we are setting up the PayPal object for use through-out the rest of the script. This will make it very easy for us to generate PayPal API requests and process responses.
Part 4
Now we fill in all of the request parameters using static and dynamic values as we have available. Not every parameter included in the API call (and as such, also included in my library) will be necessary, so many will be left blank. These will be left out of the RAW request entirely.
In this section, you’ll notice that we’re using an ActionType of PAY and we’re filling in the value for SenderEmail using the value we set previously to the sender’s email account. This sets up an implicit approval so that no login is required to submit the payment.
Part 5
Here we gather all of the request array data into a single, nested array that will be passed into the Pay() method of the PHP library.
Part 6
Now we finish everything off by calling the Pay() method and passing in our PayPalRequest data. Based on the result we get back we will either display an error page with instructions on what to do in such a case to the buyer, or in most cases, the payment will be submitted automatically and we can simply redirect to a successful page informing the winner that they have instantly been paid!
Conclusion
Using PayPal Adaptive Payments we’re able to create a unique twist on the standard practice of generating mailing lists, working with Easter eggs, and submitting payments. I hope that by using some of these techniques you will find increased traffic to your site, and in turn, increased exposure on social networking sites and more sales in general.
Happy hunting!