Here is the ad tracking I've used on occasion from http://aspfree.com. This has a stored procedure, two tables (one for tracking hits by day and by vendor, second for just storing info about the vendor). I've also used an ASPX page to grab the request.querystring, record to the database and then redirect the user to the particular link. When you write out the hyperlink programmatically or by hand goes something like HTTP://YOURDOMAIN.COM/TA.ASPX?V=1. Downloadable code available!
Here is the ad tracking I've used on occasion from http://aspfree.com. This has a stored procedure,
two tables (one for tracking hits by day and by vendor, second for just storing info about the vendor).
I've also used an ASPX page to grab the request.querystring, record to the database and then redirect the
user to the particular link. When you write out the hyperlink programmatically or by hand goes something
like HTTP://YOURDOMAIN.COM/TA.ASPX?V=1
STORED PROCEDURE
CREATE PROCEDURE dbo.sp_AdCompanyUrl ( @cId int, @URL varchar(255) OUTPUT ) AS Declare @chkRecord int Declare @numOfHits int Declare @dateSubmitted datetime set @dateSubmitted = convert(char(10), getDate(), 101) If exists (select cId from adCompanyHits where dateSubmitted = @DateSubmitted and cId=@cId) begin set @numOfHits = (select numOfHits from adCompanyHits where cId = @cId and dateSubmitted=@dateSubmitted) + 1 UPDATE adCompanyHits SET numOfHits = @numOfHits WHERE cId = @cId and dateSubmitted=@dateSubmitted end ELSE INSERT INTO adCompanyHits(cId, DateSubmitted) VALUES (@cId, @DateSubmitted)
/* I think one could use set @numOfHits = SELECT @@SCOPEIDENTITY */
SELECT URL FROM adCompanyInfo WHERE cId = @cId RETURN GO TABLES FOR STORING INFO TABLE 1 - ACTUALLY STORES INFO ON VENDOR AND NUMBER OF HITS BY DATE CREATE TABLE [dbo].[adCompanyHits] ( [id] [int] IDENTITY (1, 1) NOT NULL , [cId] [int] NULL , [DateSubmitted] [datetime] NULL , [NumOfHits] [int] NULL ) ON [PRIMARY] GO TABLE 2 - STORES COMPANY INFO ABOUT WHO YOUR DOING ADVERTISING WITH CREATE TABLE [dbo].[adCompanyInfo] ( [cId] [int] NOT NULL , [Company] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [URL] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [startDate] [datetime] NULL , [endDate] [datetime] NULL , [adDescription] [varchar] (8000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [titleDescription] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Contact_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Contact_Email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO 'code for TA.ASPX or whatever you want to name the page.
/*I use TA for 'track ad' 'this could also be re-arranged to use an ASP pages. */
<!--asp@ Page Language="vb" -->
<!--asp@ Import Namespace="System.Data" -->
<!--asp@ Import Namespace="System.Data.SQLClient" -->
<script language="vb" runat="server">
Sub Page_Load(sender As System.Object, e As System.EventArgs)
'Grab the info from querystring
dim v as integer = Trim(Left(request.querystring("v"), 1))
If Len(v) > 0 Then
'GET YOUR CONNECTION STRING FROM WEB.CONFIG
Dim conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("DSN"))
Dim cmd As SqlCommand = New SqlCommand("sp_adCompanyUrl", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim workParam As SqlParameter = Nothing
cmd.Parameters.Add(New SqlParameter("@cId", SqlDbType.Int, 4))
cmd.Parameters("@cId").Value = v
workParam = cmd.Parameters.Add(New SqlParameter("@URL", SqlDbType.VarChar, 255))
workParam.Direction = ParameterDirection.Output
conn.Open()
Dim strID As string = cmd.ExecuteScalar()
If conn.State = ConnectionState.Open Then
conn.Close()
End If
'Response.Write(strID) used for testing writing out the number.
Response.Redirect(strID) 'Put user code to initialize the page here
End If
End Sub
</script>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP Code Articles
More By Steve Schofield
developerWorks - FREE Tools! |
<a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development FREE! Go There Now!
|
|
|
|
Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success. FREE! Go There Now!
|
|
|
|
Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
|
|
|
|
Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
|
|
|
|
Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
|
|
|
|
The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now. FREE! Go There Now!
|
|
|
|
Join this webcast to learn how IBM Rational's Functional Testing solution enables you to implement automation your way, at your pace, with your existing staff. In this webcast, you’ll learn how you can eliminate redundancy of manual test scripts, reduce errors, and increase test coverage through test automation. After this presentation you will understand how IBM Rational Functional Testing solution can streamline your manual testing and make test automation easily attainable. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |