If available in your package, weather data can be accessed in marketing rules and SmartBlocks.
For example, you could:
Use a marketing rule to display a summer clothing SmartBlock when the temperature is above a specified temperature in the customer's location, or display cold weather clothing if it is snowing in the customer's location.
A weather forecast for a customer's holiday destination.
For most email systems, weather-related content is formatted when the email is opened. However, email recipients who use newer Apple devices need some consideration, as the content is formatted soon after the email is sent.
Learn more in Email privacy protection.
Weather data merge fields
Script | Description |
{{ weather.current.day }} | An abbreviated weekday (Mon, Tue, Wed, and so on). |
{{ weather.current.temp.f }} | The temperature at the location in Fahrenheit. |
{{ weather.current.temp.c }} | The temperature at the location in Celsius. |
{{ weather.current.desc }} | A descriptor of the weather type (for example, rain, cloudy). |
{{ weather.current.icon_url }} | Source URL of a weather icon (PNG image). |
Weather forecast merge fields
The weather forecast is also part of the weather set of merge fields. There is data for today and up to four days ahead, giving five days' data in total. The data for each day is almost the same as for the current weather report. The main difference is that double the number of temperature values are given: the forecast gives a maximum and minimum expected temperature (in both °F and °C).
To access the data, use {{ weather.forecast. }}
followed by the number of days ahead, followed by the data label.
For example {{ weather.forecast.plus4days.desc }}
gives a short description of the weather type expected in four days' time.
Available merge fields:
Number of days ahead | Label |
plus0days | day |
plus1days | temp_hi.f |
plus2days | temp_hi.c |
plus3days | temp_lo.f |
plus4days | temp_lo.c |
| desc |
| icon_url |
Weather location query string parameters
The location used to gather weather information can be passed in the Slot's query string.
The parameter weather_country
must always be provided if you are supplying the location with the query string. In addition to the country code, you must also supply either the weather_city
or weather_zip
parameter, but not both.
Example values:
Merge Parameter Name | Description | Examples |
weather_country | The country's 2-character ISO code. | US GB |
weather_city | The name of the city. This can also include the state separated by a comma for US cities. | New York Springfield,MA London |
weather_zip | The postal zip/postal code. | 20500 LU2 SW1A 2AA |
You need to specify the merge parameters in the Merge Parameter Names field on the Slot Edit page.
From your email campaign or website, you need to specify the city, zip code or postcode in the Slot HTML. For example, for an email campaign, you need to merge in the city name from the appropriate field in the ESP database.
IP based geocoding
If no location is passed in, then Fresh Relevance may be able to locate the user based on their IP address.
If this is available on your package and enabled.
At the end of every visitor's session we attempt to estimate their location based on their IP address. This prediction may include their country, city, time zone, postcode and GPS coordinates, with a precision of a few kilometres.
This location data is only a prediction and may not be correct.
Once the location has been calculated, the IP address of the user is deleted, and is never stored long term, for GDPR privacy reasons.
For existing users, the location of their last web session is used as their location in Slots and SmartBlocks. If this is the shoppers first session, or a previous location is unavailable, then predictions are made based on their current IP address.
Using location in marketing rules
This location data can be used by location marketing rules, and also the weather marketing rule, if no location is passed into the query string. No special setup is required to enable location data except ensuring the Slot is dynamic (metered).
Using location in SmartBlocks
Location data can also be used in SmartBlocks, either by the Weather SmartBlock or in Jinja merge variables. To enable this, the SmartBlock must be dynamic (metered) and have the Geocode by IP option enabled on the Properties tab. The weather SmartBlock uses the IP location automatically if no location data is passed into the query string.
Learn more in the section Geocoded location.
Attribution for Weather SmartBlocks
Weather SmartBlock templates include a visible link giving attribution to our partner who provides the weather maps. If you would prefer to remove this from the SmartBlock, then you must provide prominent attribution information and a link in the same way as you show your own copyright information and with equal clarity, for example, in your copyright message, on your legal page or within the email.
For your reference, this is what the provider says in their terms:
Attribution — You must give appropriate credit, provide a link to the OpenWeatherMap.org, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.