Solved

Grab domain for email on linked web site

Posted on 1998-10-24
23
190 Views
Last Modified: 2008-03-17
I assume this is a Perl question -- I'm ignorant about these things!  This much I know -- my web site is run on a Unix system.  Apache, as I recall, my system administrator told me.

I have put my banner on different web sites.  When the user clicks on the banner s/he is sent to my web site.  I would like some way to identify the source web site so that if the user becomes interested in my product, and decides to click on my email form, there appears on the subject line of the email form the name (or some brief numeric code) of the web site that referred that person to me.

So in other words, I need a way to grab the url/domain name where the person came from, and then whenever that person clicks on my page's email form, there appears on that email subject line a code that lets me know where that person came from -- so I later can credit the referring web site when I look at the email I received.  (Whew!)

If that's all the CGI script did, I would be happy.  But it would be even nicer, if at the same time it added the code to the email, it also put carbon copy infomation so that if the person emailed me a form, it also sent a carbon copy of their email to the email address of the web site that the person came from, so that the person who's site my banner ran on got notified that the person sent me email.

Obviously many times a person would arrive on my site from a domain/url where I have NO banner, so in that case the CGI script would put a code on the email that the person came from a URL/domain where I have no banner.  

Of course I would have a list of the email addresses of those web sites where I have placed my banner, so that the CGI script could refer to that list when it does its thing.

I hope I (a certified CGI Ignoramus) have provided enough information so that one of you experts can provide a solution.  And yes, I have access to my CGI-BIN.

Regards,


Rowby Goren
0
Comment
Question by:Rowby Goren
  • 11
  • 11
23 Comments
 
LVL 2

Accepted Solution

by:
WileyKat earned 250 total points
ID: 1205664
The first part is as simple as checking the environment variables REMOTE_HOST and HTTP_REFERER. REMOTE_HOST contains the domain name (if any, otherwise IP) of the browser accessing the CGI, HTTP_REFERER contains the URL of the site the browser sending the request just came from (some older browsers might not set this).

The second part requires knowing beforehand the email of each site for which you have a banner. That ties in with the list you mentioned.

The third part is as simple as using a classic if-then construct (don't you love those technical terms? ;-) ) to determine whether the domain the person came from has a banner.

I can help you write the script or I can write it for you. If I write it for you, I would request 200 points for the work involved. Hope this helps you.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205665
You obviously know what you are doing, so I shall give you 250 points!

Thanks,


Rowby
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205666
I guess this comment is to ask you, yes, please write the script.  I don't know how to do any programming!

Thanks, Rowby
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205667
No prob, Rowby. I'll have it written ASAP. Apologies in advance for delays.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205668
Thanks!  Looking forward to your solution!


Rowby
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205669
So am I :-). This isn't the sort of script I do often; I just have the skill in case I need it :-). That and my numerous reference books! ;-). Seriously, I'll get it to you as soon as I can.
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205670
I need to request a bit more infomation here, sorry:

1. There are two ways for this to function:
  a. At the banner page, the banner has a line <A HREF="http://(your site)/cgi-bin/bannerclick.cgi?account=(siteID)">. Therefore, I have the CGI retrieve the site ID directly from the input.
  b. At the banner page, the banner has the same thing minus "?account=(siteID)". Therefore, i use REMOTE_HOST to lookup the site from a file.
 I need to know which to use. I'd recommend the first one; it's more reliable and it's faster. The only reason to use the second option is that it might be a bit easier for the webmasters to maintain.

2. Exactly where do you want me to store the information I get? You said that if the user clicks an email link on your page after clicking a banner, I should have the email subject be that the person clicked into your site from x banner. Might I suggest you do this slightly differently:
  a. When the person clicks the banner, have the CGI immediately send you an email containing as much info as I can gather from the browser. Then when the person enters the email page, have it ask a question like "How did you get to this site?".
  b. If that isn't good, how about letting the user enter the subject and I send the info from a hidden field instead of a line that the user could change?
 In fact, this time, I'd use the second option. But it's up to you. If you don't like either of these, could you explain your original idea a bit more fully? I don't quite understand it perfectly.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205671
I like the second option: 2B:   I like the info coming from a hidden field.  

It sounds exactliy what I'd like.  The hidden field providing me as much info as you can get from the browser.  

And, if possible, I would like a carbon copy of that person's email to me also sent to the referring banner URL, letting them know that a person has sent me an email.  

Thanks!

Rowby
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205672
lemme see if I've got this right:

you like the hidden field with as much info as possible
you want a CC of the email you get sent to the correct website for the banner that was clicked.
that still leaves me in the dark about option one. do I do a file lookup from the HTTP_REFERER, or do I get the info from the banner click itself (QUERY_STRING)?
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205673
let me point out that using QUERY_STRING is much easier on me and the script will most likely execute faster using it.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205674
It's weird.  I thought I answered your response.  But it didn't seem to appear.

I'd prefer 2B.  It's exactly what I'd want.  

And, at the same time, I would like (as I indicated in my original request), if possible, for an email to be sent to the referring URL -- taken from an email list that I would keep on my server.  It should be a blind carbon copy of the email that the person sends to me (if they choose to send me an email, that is) after they arrive on my web site.  And I like the idea that you have in 2B where it's sent from a "hidden field instead of a line that the user could changee".  That soulds perfect!

Thanks.  (And if my response is a duplicate, it's because I didn't see my submitted response here to your last response!)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205675
I'm looking now at your 2:39 PM response, which for some reason did not appear until now.

Being a non  programmer I'm not sure what the difference is from a QUEERY STRING or a BANNER Refrerrer.

But I do know this.  I dont want to get an email every time someone clicks on my site. I only want to get an email when someone looks at my site, decides what I have to offer is something they're interested in.  And then they send me an email.  It is that email that I want to have the referring information included to me in the "hidden field".

I hope what I'm asking is the simple and easiest for you to do.

If not, maybe you need to help me understand the difference between the Querry and Referrer technique is.  

Thanks!

Rowby
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205676
For some reason when I'm reading this thread, occasionally responses are missing.  Now I have the complete thread and I realize what you wanted to know in your 2:40pm comment.

Go ahead and do the QUERY STRING.  That will be just fine.  I'm the only webmaster so I can handle the "paperwork".

Thanks!

Rowby
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205677
As far as the missing comments, maybe it's a trouble with reloading the page or something with EE, I don't know. I don't think it really matters much, as long as it comes out right in the end :-).

Let me list the feature list I've compiled based on your comments:

1. A click on a banner will record info from the browser and redirect to your main website page. That's all for then.
2. A click on an email link will send the user to a page where they can send an email.
  a. That form should have a hidden field with the info gathered from the banner click, if that person clicked on a banner. If not, just info on that person.
  b. If the persondid come from a banner, a BCC should be sent to the webmaster of the site of the banner that was clicked.
  c. The email will be sent to you with the fields the user filled out plus the hidden info I compiled.

As far as the difference between the QUERY_STRING and HTTP_REFERER techniques, it is thus:

1. Using QUERY_STRING, the webmaster of the bannered sites will link the banner like so: <A HREF="http://(your site)/cgi-bin/bannerclick.cgi?siteid=(that particular site's ID #, which we'll assign)>. My CGI will pickup the site ID directly and use that. It's easier on me that way, not to mention it will work with some very old browsers.
2. Using HTTP_REFERER. the webmasters will link the banner with: <A HREF="http://(your site)/cgi-bin/bannerclick.cgi>. My CGI will NOT pick up the site ID and will use HTTP_REFERER to do a URL lookup in a table (in a file) which will translate the URL to a site ID, which I will then use. It's harder on me, and the script might be slower, AND some very old browsers might not send HTTP_REFERER, but it is easier on the webmasters with your banner, because they won't have to keep track of their site ID.

Quite frankly, I'm glad you chose QUERY_STRING. It is the better option :-).

If you give me the OK on the stuff I outlined above (feature set), I'll be ready to get some real work done and should have the script ready within a week or two, probably less.

BTW, when you get notification that a comment has been added, but you don't see the new comment, try hitting the reload button in your Web browser.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205678
Yes, I realize now that the reload/refresh button would have solved the mystery of the missing posts.

I've carefully read your description of what I want, and it is exactly what I need.  It all makes sense, especially when considering older browsers.

So I'm "officially" giving you the OK on your feature set of your 7:01 PM post.

And I (patiently) await the script.  And thank you again!

Rowby Goren
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205679
Pardon my next line of text please.

WHOOOOOPPPPPPEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!!!!!!!!!!!!!!!!!!!!!!
Now back to our regularly scheduled comment.

Seriously though, it's good that we've finally agreed on exactly what should be done. I'll start working on it. I'll be mostly unable to test it, however (I don't have the facilities), so we'll have to go through a cycle of test/fix. Or, if you're using a UNIX server, giving me a login would be very helpful (I realize this could be a lot to ask. Ignore it completely if you aren't running your own server, if you're using an ISP's server. If you are, I won't ask you to give me your password. That would be silly. I think I have a UNIX shell account I can test it with; no guarantees.) In any case, I can give you a script; god only knows if i can give oyu a working script :-). Honestly, I'll write it and see where we go from there. Catch ya as soon as I have something we can try out.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205680
WileyKat, send me email (when you're ready) and I'll give you the login and passowrd.

rowby@earthlink.net

Thanks, Rowby
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205681
You amazingly trusting and wonderful person ;-)

Seriously though, my email = macprogfreak@geocities.com
If you have ICQ (www.icq.com), my ICQ # = 12637347
0
 

Expert Comment

by:ajtech
ID: 1205682
So I paid 25 points to see the answer and the answer is not here?
What a rip-off! Is there any way to post the answer? This is not the intent of experts-exchange!
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205683
Sorry, ajtech.  I don't know how this thing works!  In any case, WileyKat is still working on the solution.  When he finishes it I'll be sure the answer is posted here.  Also, if you send me your email address I will notify/give you the answer.

rowby@earthlink.net
0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205684
yes, I will post it here if it is not too big for my browser to put in the text box :). Otherwise rowby can email it to you, ajtech.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 1205685
Everyone, I am reopening this request to everyone.  WileyKat has had to take care of other business, and is unable to finish this project at this time.  I've had some email exchanges with him, and we decided that reopening it would be the best thing to do.  WileyKat's solution seems to be the correct and best one, so I would welcome anyone stepping in and taking what appear to be just a few final steps to execute the solution.

Any takers?


(And sincere thanks to WileyKat, a very talented person indeed!!)

Rowby

P.S.  I hope I can simply reopen this question with this comment. If not, can someone tell me how to do it?


0
 
LVL 2

Expert Comment

by:WileyKat
ID: 1205686
ironically, Rowby, I can answer that. (That's what I get for staying on the email notification list for this question :) In order to reopen the question, you must post a new question (with a reference to this one) to EE.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video discusses moving either the default database or any database to a new volume.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now