Codefixer - ASP tutorials, resources and software
asp.netPRO “ASP.NET Hosting with US & UK Data Centers!
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Monday 5 January
MembersPro PayPal - ASP Membership software



ASP.NET Hosting with MS SQL 2008!


How to track your Customers

This short article will show you how to create a basic tracking system that will let you know what referring sites your customers are coming from. Knowing where your customers come from can help you assess the success of a particular advertising campaign.

We will use the example of running a hypothetical banner ad campaign on ASPIN.COM. ASPIN is a big ASP resource directory and as such is a great place to run an ad campaign targeting ASP developers. So for our example we are going to run a banner ad campaign promoting our new software product ‘MembersPro PayPal’ and we’ll use PayPal as the payment provider to sell it.

There’s 3 key stages in our tracking system

1) Attaching a querystring to our referring URL
2) Using cookies
3) Using PayPal's ‘custom’ field


1) In setting up our banner campaign on ASPIN we sent their advertising department our banner along with a click thru link. The link we provided was (www.codefixer.com/app_mpV4_paypal/default.asp?source=ASPIN). Notice the attached querystring on the end of the URL and the value of source i.e. ‘source=ASPIN’ .
This lets us know that the visitor has arrived on our product page courtesy of our campaign on ASPIN.
Alternatively If we ran a Google Adwords campaign you could change the tracking URL to www.codefixer.com/app_mpV4_paypal/default.asp?source=GOOGLE

2) Below is our source code that we can put at the top of our landing ASP page.

<%
If Request.querystring("source")="ASPIN" Then
'write a cookie for ASPIN
Response.Cookies("siteReferral")="ASPIN"
Response.Cookies("siteReferral").Expires=Now+365
End If
%>

Essentially all our code is doing is checking if the visitor has arrived at this page from ASPIN, i.e. is our querystring equal to ASPIN. If the potential customer has indeed arrived through ASPIN a cookie will be written to the visitors hard drive. This cookie will last for 365 days so if he goes away and comes back again atleast we know that initially he was directed to our product from ASPIN.

3) Now lets look at the source code for our PayPal buy now button.
You can read more about PayPal buy now buttons and the fields required from the manual at
https://www.paypal.com/cgi-bin/webscr?cmd=p/xcl/rec/singleitem-manual-outside

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="michael@codefixer.com">
<input type="hidden" name="return" value="http://www.codefixer.com/applications/thankyou.asp">
<input type="hidden" name="cancel_return" value="http://www.codefixer.com/applications/cancel.asp">
<input type="hidden" name="item_name" value="MembersPro PayPal">
<input type="hidden" name="item_number" value="12">
<input type="hidden" name="amount" value="199">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<% If Request.Cookies("siteReferral")="ASPIN" Then %>
<input type="hidden" name="custom" value="ASPIN">
<% End If %>

<input name="submit" type="image" src="/images/paypalbutton.jpg" border="0" width="70" height="39">
</form>

The important aspect for us is the code in red. PayPal allows us to use a custom field. We will take advantage of this custom field and use it to track whether our customer has come from our example ASPIN campaign.
If the customer has landed at our product page from the ASPIN Ad then the custom field is created as the Cookie “SiteReferral” will have the value ASPIN. If the visitor then proceeds and purchases our product we will receive a “NOTIFICATION OF PAYMENT” email from PayPal and in the email there’ll be a custom field that will say ‘ASPIN’ (see screenshot below).



That’s a fairly simple way to build a tracking system. Hopefully this article will give you some ideas on how to build a bigger and better tracking system.

Related tutorial 'The Querystring'
Related tutorial 'Read and write Cookies'



MembersPro PayPal - ASP Membership software

Membership Software Integrates with PayPal

  • Plug and play Membership script.
  • Recurring subscriptions or one time payment.
  • Up to 3 levels of membership subscription.
  • Easy set up and admin with free installation.
  • Works with PayPal.
  • Receive updates and add-ons for 2 years.
  • 1st class support and customization available.
  • Can be customized to support more levels.
  • Saves you hours and hours of development time and money.
  • PURCHASE YOUR COPY TODAY




3 MONTHS FREE – ASP.NET Hosting w/ US & UK Data Centers – Click Here!





About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software