How To Create Email Alerts From Phone Call Tracking Numbers
May 22nd, 2008This how-to article will show you how to create your own custom email alerts that triggers when a Mongoose Metrics phone number is dialed. The email alert can contain all the call details from the phone call including incoming caller phone number and call time duration. To implement this feature you’ll need access to a web server that can send email through a scripting language processed on a web page. Our example will make use of PHP’s mail function.
Understanding Mongoose Metrics Dynamic Variable Insertion
With all Mongoose Metrics phone call tracking numbers you can elect to have a URL visited every time the tracking number is dialed. However, an advanced version of this feature exists which enables you to dynamically append to your elected URL variables which will be populated real-time with the phone call details.
As an example, a URL with the parameter syntax of :
http://www.mongoosemetrics.com?incoming_caller=CALLER_PHONE
would construct the URL if dialed by the number 216.502.2750:
http://www.mongoosemetrics.com/incoming_caller=2165022750
The above example makes use of the Mongoose Metrics dynamic variable CALLER_PHONE which acts as a place holder in the URL string. When the tracking number is dialed and the call is completed, the Mongoose Metrics phone server will see this place holder variable in your URL string and replace it with the actual data from the live call.
Here are some of the dynamic variables available:
CALLER_PHONE - The incoming caller’s phone number.
CALL_DURATION - The total billable length of the call.
CALL_DATE - Date of the call.
MONGOOSE_NUMBER - Trackable phone number which was called by caller.
CALL_DESTINATION - Destination number that trackable number points to.
Step One - Construct Your Tracking URL
- From the ‘Trackable Number’ tab in our Mongoose Metrics account, click on the ‘configure’ link to the right of your tracking number.
- Next, construct your URL which will be visited every time your tracking phone number is dialed. To send to your email alert meaningful information about the call, use some of the above dynamic call variables in your URL string. Here’s an example URL string which would be placed after the domain name portion of your URL: /?phone_number=CALLER_PHONE&call_time=CALL_DURATION
When the tracking number is dialed, Mongoose Metrics will construct the URL string and visit the URL. The phone server will replace CALLER_PHONE and CALL_DURATION with the actual data from the phone call. In this way you have now passed from the phone call the call detail information and sent it to a web server for further handing.
Step Two - Creating An Email Script
Our example will use PHP’s mail function. To review, we now will have a web page visited every time a tracking number is dialed and the web page will be visited by the Mongoose Metrics phone server with a URL string that’s populated with the phone call details. You next have to grab the data found in the URL string and insert this into your email alert message. With PHP this is fairly straight-forward. Here’s how:
On the web page that the Mongoose Metrics phone server will visit place this code snippet above your<html> tag. This code example will look for the URL parameters phone_number and call_duration. If it finds these parameters in the URL string, it will grab their values and send them off in an email.
<?PHP
$phone_number = '-1';
if (isset($HTTP_GET_VARS['phone_number'])) {
$phone_number = $HTTP_GET_VARS['phone_number'];
}
$call_duration = '-1';
if (isset($HTTP_GET_VARS['call_duration'])) {
$call_duration = $HTTP_GET_VARS['call_duration'];
}
?>
Next you need to paste anywhere in the web page code so long as it’s below the above snippet the code that actually sends out the email. Here’s some example code to get the job done. It may be adapted to your needs of course.
<?PHP
if ($phone_number <> '-1') {
$to = 'me@mydomain.com';
$subject = ' '. $phone_number .' | ' . $call_duration .' - Phone Call Alert';
$message = '';
$headers = 'From: alerts@mydomain.com' . "\r\n" .
'Reply-To: noreply@mydomain.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
?>
The above code example will send an email with a subject line only. In the subject line will be the incoming caller’s phone number and call time duration.
Adaptations And Uses
The above information gives you the basic picture and setup. From this you can now fire off email alerts whenever your tracking number is dialed. Keep in mind that since this implementation requires you to develop your own processing code to construct the email, the variations on what you can do are endless. Here are some additional examples of how to further adapt this method:
- Send the email if the call duration is over or under a certain call duration length
- Send the email to different recipients based upon the area code of the incoming caller
- Send the email if a specific tracking number is dialed
- Send the email if it’s called from a specific keyword or campaign
- Send the email based upon the time of the call
- Instead of an email, why not insert the data into the server’s database for additional processing or advanced metrics. This could include associating the incoming caller’s phone number with a web sales or lead generation conversion or archiving the data as apart of a longer sales cycle.
Ok, we have given you some example of what you can do with this method, but why send email alerts from trackable phone numbers in the first place? Only you can decide if this implementation provides value to your online marketing campaigns. However, here are some examples of how Mongoose Metrics customers can make good use of this method.
- Missing Calls. Phone call conversions from paid search campaigns can be quite valuable depending upon your market. We can all see missed calls with our existing phone systems already and Mongoose Metrics call detail reports will show you complete call logs. But lets face it, in a sea of phone calls and missed phone calls sometimes you (or your clients) can still miss the message and not return the call as quickly as possible. If you’re on the go or on the phone a great deal, missing phone calls is a part of life and email alerts can provide a tremendous amount of urgency and clarity in deciding who needs to be called back first.
- Sales Management. When phone call leads are valuable. Looking at call detail reports at the end of the day or at the end of the week sometimes isn’t fast enough. Email alerts can be constructed for sales managers so that they can easily see what’s going on with phone call leads and have a quick measurement of call volume and phone call time durations.
- Client Notification. We are swamped with data and reports. In many business environments it’s just not realistic to expect clients to log into reports and invest time digesting the data. Yet clients still want to know what’s going on. If a simple subject line email makes the difference between communicating the right information the right way, it can make all the difference in the world.
- Flexibility. At the heart of Mongoose Metrics philosophy is delivering a phone call tracking service that’s flexible and can deliver phone call tracking data however and where ever you need it to go. Sending email alerts with phone call details is another example of our commitment to provide information that is adaptable to your way of business.

