Foros de discusión

How to target audiences based on the location?

thumbnail
Sushil Patidar, modificado hace 9 años.

How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,
I am exploring content targeting app. For a requirement i created a user segment(name="India audience") in which i added a rule of location. In the location rule i have selected (country="India",region="Maharashtra") .But it don't seem to work. Is the location based rule supported by content-targeting app.
Please help how i can proceed?


Thanks and Regards
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: How to target audiences based on the location? (Respuesta)

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi Sushil,

The Location Rule is based on the IP Geocoder module, which determines the user's location based on his IP address. If you're testing it with a local IP Address, it won't work. Is this your case?

Regards
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,

Yes this is my use case. How can i test it on local server?
Would you please suggests steps to test it on local server?

OR

Please suggest how i should proceed to test it?

Regards
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Any help please?
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: How to target audiences based on the location? (Respuesta)

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi Sushil,

You'll have to use software/hardware WAN emulation to test this locally. Alternatively, if you're a developer you can obtain the source code from our repository, start Liferay in debug mode and inject the IP value you want to test to see the result.

Regards
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,
I debug the code. When i give different ip it gives the location. In the code i found that
String ip = anonymousUser.getLastIp();
line in IpGeocodeRule.java always give the ip of server not the ip of user who is accessing.
Logically it should give the ip of the user because we are tracking user.

Regards
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: How to target audiences based on the location? (Respuesta)

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi,

The IP is obtained from the request and it corresponds to the IP address of the client or the last proxy that sent the request . See http://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#getRemoteAddr().

If you're accessing your test server with http://localhost:port/, you will get the remote address as 127.0.0.1 (local host address i.e. loop back address). Instead, try accessing the URL using your system/server name to get the desired output (in your case, your LAN IP). You can also try to browse your server from other machines on the same network to see how it works.

We have plans to also check the X-Forwarded-For header (which is a defacto standard to retrieve the original IP through proxies).

Regards
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,

Right. I checked it as per your suggestion. It gives IP of the user.
Thanks for helping me till this point.

I am accessing the server URL from System whose address is mapped through NAT (http://en.wikipedia.org/wiki/Network_address_translation) .
Or
I am accessing the server URL from System which is connected to the internet through Data Card.

In above cases the ip geocoder API is not able to fetch the location through IP. Need your valuable suggestion to reach the final point.


Regards
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Any further help please?
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: How to target audiences based on the location? (Respuesta)

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi Sushil,

Basically there're only two things to verify with the Location Rule:

1. Audience Targeting determines your user's IP properly (remember, the IP of the last client in the request chain).
2. The IP Geocoder module determines you user's location based on the IP. This works only if the IP address obtained in (1) is not local.

For (1) you can debug and check what IP is being retrieved from the request. For (2), you can use this demo tool to test what location corresponds to the IP determined in (1).

Regards
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,
Thanks a lot for the help.
One final question.
I checked with demo tool . Tool gives location of the almost all the IP's.
But Content targeting app, for some IP it don't gives location.
Is it synched with the MAX Mind database?

If it is not synced,where database is located in the App and how to update it?


Regards
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: How to target audiences based on the location?

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi Sushil,

Audience Targeting makes use of the Liferay IP Geocoder service module (which is not part of the Audience Targeting project, but it's installed alongside as a dependency) to obtain location information from the IP Address.

Notice that the IP Geocoder source code is contained in Liferay-Portal master branch. It's published from here to the Liferay bundle repository, from where other apps (like Audience Targeting) can consume it.

If the IP Geocoder module is not resolving all the IPs it might have to be updated. You can create a feature request for this through our issue track system. In the meantime, you can provide your own implementation of the IPGeocoder interface and use either a more recent version of Maxmind database, or a completely different IP-geolocation service. And of course you can contribute it if you're happy with the result :-).

Regards
Mike Boston, modificado hace 9 años.

RE: How to target audiences based on the location?

New Member Mensajes: 3 Fecha de incorporación: 4/03/15 Mensajes recientes
a nice idea emoticon
thumbnail
Sushil Patidar, modificado hace 9 años.

RE: How to target audiences based on the location?

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,
As per your suggestion i have created feature request .
This good idea to create own implementation of the IPGeocoder . The first thing come to my mind is to fetch location using Google API.
Can anyone suggest me how to fetch location from Google Map in Java code?

Regards
thumbnail
Lex van Sonderen, modificado hace 8 años.

RE: How to target audiences based on the location?

New Member Mensajes: 8 Fecha de incorporación: 20/11/09 Mensajes recientes
Eduardo P. Garcia:

Basically there're only two things to verify with the Location Rule:
1. Audience Targeting determines your user's IP properly (remember, the IP of the last client in the request chain).
2. The IP Geocoder module determines you user's location based on the IP. This works only if the IP address obtained in (1) is not local.


Hola Eduardo!

I tried using a proxy server and the browser tool Zenmate to change my perceived location. However it always seems to find my real location. How come?

PS. I have seen the nifty simulator, but I prefer like to test using independent tools.

Thanks, Lex
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: How to target audiences based on the location?

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi Lex,

Are you testing with Audience Targeting locally (i.e. you access through a local IP/host) or remotely? If it's the first case, ZenMate won't mask your local IP, so you cannot use it for this kind of simulations. If it's the second case, ZenMate should work as a proxy and change your remote IP into one from other country (e.g. in my case, I browse from Spain but I get a simulated British IP). In this case, Audience Targeting should be resolving your location properly.

Could you please confirm what's your case?

Thanks!