Hi All,
does anybody already managed to use the clients-timezone within a trafficscript rule?
i know it could be found via javascript-function, but i don't have a idea how to transport this information to STM...
-Jochen
Solved! Go to Solution.
One example using an external service to map the geoip information into a timezone name or ID.
$ip = request.getRemoteIP();
$lat = geo.getLatitude( $ip );
$long = geo.getLongitude( $ip );
$googlejson = http.request.get( 'https://maps.googleapis.com/maps/api/timezone/json?location='.$lat.','.$long.'×tamp=0&sensor=fa...' );
$googlehash = json.deserialize( $googlejson );
$timeZoneName = $googlehash['timeZoneName'];
$timeZoneId = $googlehash['timeZoneId'];
log.info( "Time Zone Name: ".$timeZoneName );
log.info( "Time Zone ID: ".$timeZoneId );
*This rule will add the time it will take to look up the information form Google.
**I would read the The Google Time Zone API - Google Maps API Web Services — Google Developers before use. You may want to get your own key.
One example using an external service to map the geoip information into a timezone name or ID.
$ip = request.getRemoteIP();
$lat = geo.getLatitude( $ip );
$long = geo.getLongitude( $ip );
$googlejson = http.request.get( 'https://maps.googleapis.com/maps/api/timezone/json?location='.$lat.','.$long.'×tamp=0&sensor=fa...' );
$googlehash = json.deserialize( $googlejson );
$timeZoneName = $googlehash['timeZoneName'];
$timeZoneId = $googlehash['timeZoneId'];
log.info( "Time Zone Name: ".$timeZoneName );
log.info( "Time Zone ID: ".$timeZoneId );
*This rule will add the time it will take to look up the information form Google.
**I would read the The Google Time Zone API - Google Maps API Web Services — Google Developers before use. You may want to get your own key.