News: When asking for support, it helps us and you, if you read the Posting Guidelines

Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

April 02, 2020, 10:02:42 AM

Login with username, password and session length

Recent

Members
Stats
  • Total Posts: 189572
  • Total Topics: 20808
  • Online Today: 625
  • Online Ever: 917
  • (January 21, 2020, 09:02:26 AM)
Users Online
Users: 1
Guests: 181
Total: 182

Author Topic: View block by what country user is from?  (Read 8189 times)

0 Members and 1 Guest are viewing this topic.

ApplianceJunk

  • Guest
View block by what country user is from?
« on: August 26, 2009, 04:47:53 PM »
I have a new appliance parts affiliate that has two different websites.

They have one site for Canada (.ca) and a .com site.

Could two TP blocks be set up so visitors to our site from Canada see one block and visitors from the USA see the second block?

JPDeni

  • Guest
Re: View block by what country user is from?
« Reply #1 on: August 26, 2009, 04:52:29 PM »
Probably. I don't know how to tell where the visitors are from, though. There must be some environmental variable, but I don't know what it is.

Actually, though, it wouldn't be two blocks. It would be one block with different content, depending on where they come from.

ApplianceJunk

  • Guest
Re: View block by what country user is from?
« Reply #2 on: August 26, 2009, 05:38:13 PM »
Quote
It would be one block with different content, depending on where they come from.

What ever would work best. I was thinking how I can set up a block in say the top right corner and have it set up so only visitors see it and then a second block in the same location that only members see.

This way it's two different block in the same location, but only one is being viewed at a time depending on if you are signed in or just visiting as a guest.

ApplianceJunk

  • Guest
Re: View block by what country user is from?
« Reply #3 on: August 26, 2009, 05:39:58 PM »
Quote
I don't know how to tell where the visitors are from, though

How does google analytics show me in my stats how many visitors come from Canada?

Is it done with IP address?

JPDeni

  • Guest
Re: View block by what country user is from?
« Reply #4 on: August 26, 2009, 06:02:08 PM »
Quote
Is it done with IP address?

Probably. I found some partial code, but I couldn't find the whole thing that would actually work.

Offline Freddy

  • Code
  • *
  • Posts: 1615
    • AiDreams
Re: View block by what country user is from?
« Reply #5 on: August 27, 2009, 05:18:44 AM »
I wanted to do this once on a site i had, but all I found at the time was I needed a huge database.  So this interested me, I have some code on looking up the country from the IP which works (without big database) so let me know if you need it JP :)

Oh BTW, this isn't SMF code...not sure if it would be better to use SMF code or this  ???
« Last Edit: August 27, 2009, 05:32:08 AM by freddy888 »

JPDeni

  • Guest
Re: View block by what country user is from?
« Reply #6 on: August 27, 2009, 07:25:51 AM »
I may have found something that I can use, but I'm not sure I understand how it works. Or if it works at all. Before I post anything here, I'll do a little test on my site and get my members to help out. I'll be back in a day or so after I've had a chance to work with it.

mc

  • Guest
Re: View block by what country user is from?
« Reply #7 on: August 27, 2009, 08:18:51 AM »
I've just read the first post, and if there are two seperate domains, then would it not be easier to detect what domain (ca or com) the visitor is using?

Offline Freddy

  • Code
  • *
  • Posts: 1615
    • AiDreams
Re: View block by what country user is from?
« Reply #8 on: August 27, 2009, 08:23:15 AM »
Yes good point  8)

JPDeni

  • Guest
Re: View block by what country user is from?
« Reply #9 on: August 27, 2009, 08:27:15 AM »
The way I read the original post is that ApplianceJunk has a website with one domain. He is an affiliate of an appliance parts company which has two websites, one for the US and one for Canada. He is wanting to direct his US visitors to the parts company's US site and his Canadian visitors to the parts company's Canadian site.