Forum Moderators: phranque

Message Too Old, No Replies

How do I serve SSI 1 if user is from US/ SSI 2 if user is from UK

this is a newbie question, please bear with me

         

Macro

12:36 pm on Nov 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a Frontpage website on Windows shared hosting and want to put some affiliate code across the site. But I want each page to call up the code for the UK company's affiliate program if the user is from the UK or the US company's affiliate code if the user is from the US.

Any easy way to do this? I can create two SSI pages one with each program's affiliate code but how do I get the site to serve the right SSI page (include page) depending on the user's location?

Or is there another way this needs to be approached?

Macro

11:12 am on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<bump>

encyclo

1:16 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't do this with FrontPage alone. In order to distinguish between US and UK visitors, you need to detect the IP address of the visitor, compare it to a list of IP address blocks (which are issued geographically), and make the include conditional on the result. You will need to use a server-side scripting language (PHP, ASP...) to do the work for you.

There are certain other problems you might encounter, too. For example, I'm not sure AOL UK users would use an IP address from a UK block, or via a US AOL block - which would mean AOL UK users receiving the US affiliate code.

You might want to look at a different approach. For example, if there is some sort of ordering process, you could split the UK and US visitors to a .co.uk and .com site respectively. However, without knowing your exact situation, it is difficult to make suggestions.

Macro

1:58 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for your advice.

>>You will need to use a server-side scripting language (PHP, ASP...)

Aha, can this ASP thing you speak so highly of distinguish between the keyboard setting in Windows and take people to the UK affiliate program if they have a "UK English" keyboard? That's the only way I can definitely filter out the UK visitors (if it works). And then I'll let rest of world + dog go to the US affiliate program.

Someone once setup some asp pages for me in one of my Frontpage webs so I assume I can edit these ASP files in Frontpage but I don't have a database of IPs sorted into different columns for different countries.

If I know what's possible and what's not - and what's the best way - I will pay someone to do the job for me

>>However, without knowing your exact situation, it is difficult to make suggestions

While I can't post URLs I'll be happy to explain in a bit more detail. I've got a long established widgets.co.uk site that's going to stop selling widgets. It has 2000+ inward links and gets about 10K uniques a day and it would be a shame to let that go to waste. These widgets go for roughly 0.5 to $1 per click or $20 per sale. I'd like to post some content on the existing pages to "push" visitors towards other companies still selling widgets. There are plenty that offer affiliate programs but I haven't been able to find one that ships to both US and UK. So I'll have to present US visitors with a different link to what I provide to UK visitors. Does that help?

[edited by: Macro at 2:07 pm (utc) on Nov. 4, 2004]

PCInk

2:02 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't think you can do that but you can check to see if HTTP_ACCEPT_LANGUAGE environment variable contains 'en-gb'. If it does they are probably British - if not, then they might not be.

I've just done a quick check on my records and about 90% of UK computers seem to have en-gb set, but the other 10% seem to have the US variety: 'en-us'.

encyclo

2:38 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PCInk is on to something good there: much simpler than messing with IP address blocks, especially if we're talking about 90% of users...

I've got some very simple PHP which can do this:

<?php 
if (strpos($_SERVER["HTTP_ACCEPT_LANGUAGE"], 'en-gb') !== FALSE) {
include 'gb-aff-code.inc'; // include for GB customers
}
else {
include 'us-aff-code.inc'; // include for the others
}?>

If you are using ASP, it would be just as easy (but I don't know ASP, so you'd have to ask in the Microsoft forum).

Macro

3:02 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great. OK, I'll take it that this can be done by asp. I'll get someone to put together some asp code for me.

The problem is that you can't insert asp code into a htm page (?). So I'll have to manually redirect 1500 htm pages to asp equivalents and then apply the code :(

No, I can't do what you guys call a mod rewrite. It's a Windows NT server with IIS

encyclo

3:07 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you ask in the ASP forum, someone will convert the script in no time.

Are we talking about a dedicated server? If so, you could just have .htm files parsed for ASP.

Otherwise, you could simply use an

iframe
which calls an ASP page which would display the banner/affiliate code. Anything other than renaming all the pages!

<added>You may well be able to do this with Javascript, too, which may be even better for you.</added>

Macro

3:24 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>you could simply use an iframe

Aha, again. Wow, yes, I've heard of i-frames. That does sound like a solution.

lloyd

10:56 am on Nov 5, 2004 (gmt 0)

10+ Year Member



This is all interesting. I am after the following info

Does anyone know how to set up a banner that appears for the UK market and a different banner for the US market when you type in the domain url.
Therefore the banner that you see is generated by where you log onto the website.

No affiliates are involved. And the site in built in htm.

mattglet

10:29 pm on Nov 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use the exact same functionality as encyclo described in message #6. Instead of including an include file, you can include your banner.

Macro

12:19 pm on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For future visitors to this page - I've now posted the request in the Microsoft/asp/.NET forum [webmasterworld.com].

freeflight2

6:02 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



there is GeoIP which is free and which provides APIs to many different languages... let's say you call 'ssi.pl' from your shtml pages:
ssi.pl could use the api of geoip to determine where the user is coming from and then have uk.pl or usa.pl do the rest.

also... while looking at their site I just saw that GeoIP also has a mod_geoip apache module:
[maxmind.com...]
mod_geoip looks up the IP address of the client end user. If you need to input the IP address instead of simply using the client IP address, you will need to use another one of our APIs.

For the country database, mod_geoip sets two environment variables, GEOIP_COUNTRY_CODE and GEOIP_COUNTRY_NAME. For other databases, see the included README file.

==> your script could access these enviroment variables and go from there

Macro

6:30 pm on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



APIs , ssi.pl, mod_geoip, api of the geoip, us.pl, uk.pl, apache module, environment variables..

freeflight2, thanks for your help but... I've no idea what you are talking about, mate.