Геотаргетинг

Главные вкладки

Аватар пользователя wrangler wrangler 8 ноября 2015 в 6:51

Здравствуйте.
Какие существуют решения Drupal для работы с гео?
К примеру, нужно определить регион посетителя или даже город (например popup показать, как это делают популярные интернет магазины) и выводить содержимое, учитывая это условие.
Нашел несколько модулей которые, как показалось, это реализуют, но я, признаться, запутался. Спасибо вам за любые ответы.

Комментарии

Аватар пользователя Advin Advin 8 ноября 2015 в 19:30

Попробуйте views global filter посмотреть (это для фильтрации содержимого). В readme помнится даже пример с подобным функционалом описан.

Аватар пользователя univerico univerico 6 декабря 2019 в 1:17

Кто-то использовал его?
Мне нужно выводить блоки или ноды только для определенного города.
Ставлю geoplugin
Но не пойму, как он работает.
С views global filter тоже там куча настроек.
Кто-то пробовал его? Он вообще с нашими адресами работает? Его же в связке с Smart IP
или GeoIP? Как это все применительно к нашим адресам потом работает? Пробовал кто-то?
Вот это изучено, но пока не налажено
https://drupal.ru/node/80960
https://www.drupal.org/project/geoplugin

Вот это цитата из read me глобал фильтра
"GLOBAL FILTER FOR ADDRESS OR VISITOR'S LOCATION (GEOFIELD, LOCATION MODULES)
============================================================================
To configure the global filter block for use with the Location module select as
before as the driver the pseudo-field "Location module: Distance/Proximity".
When using Geofield, select the name of the correct field from the drop-down.
For the widget select "Proximity (reference location and distance)".
The widget renders as a small form with two fields. The first is to specify a
distance, in km or miles as configured on the Views contextual filter UI panel.
The second field when left blank will default to the user's current position
as retrieved by module IPGV&M (drupal.org/project/ip_geoloc), if enabled. If
an address or approximate address, like "Melbourne, Australia" is entered, then
the Google geocoding service will be used to obtain lat/lon. This requires the
Geocoder module.

GLOBAL FILTER FOR CITY, NOT USING LOCATION OR GEOFIELD MODULES
==============================================================
Here are three examples. For an IP-based lookup of the visitor's location
configure either Smart IP or GeoIP API. For an HTML5 (i.e GPS) location based
approach also configure IPGV&M. We assume that you have already defined a
field named "City" (field_city) on one or more of your content types. This
field may be either a text field or taxonomy term reference.
At /admin/structure/block find a block named "Global filter block # (not
configured)". Press "configure".
Enter in the "Block title" box.
In the dropdown "Choose the field to be used as a global filter" find your
city field: "Field: City (field_city)". Widget: "Inherit from field".
Under "Alternatively specify a default through PHP code" enter a code snippet
as per below.
When using Smart IP, enter:
<?php return $_SESSION['smart_ip']['location']['city']; ?>

When using GeoIP API enter:
<?php $loc = geoip_city(); return empty($loc) ? 'default' : $loc->city; ?>

Or when using IPGV&M:
<?php $loc = ip_geoloc_get_visitor_location(); return $loc['locality']; ?>

For the "Region setting" select "Content". Finally press "Show block only on the
listed pages" and enter the path to your View. Click "Save block".
Now go back to edit your View.
In the "Advanced" fieldset on the right "Add" a Contextual Filter for "Content:
City (field_city)". On the next panel press "Provide default value", then for
the Type select "Global filter (field or search terms)". Click "Apply".
Save the View.
That should be it. Log out. Go to the URL associated with the View and it
should be filtered by your city. You should also see a text box there to filter
the View by any city you type. This should work for both logged-in and anonymous
users. A further option is that if the same field_city is also added to the user
profile at admin/config/people/accounts/fields, (e.g. "My favourite city"), then
the value entered by the account holder on the "Edit account" page will become
the initial value of the exposed filter.
Note: this solution may not work when you're not connected to the Internet and
your IP address is "localhost", 127.0.0.1.
"