Geo Script
Conditionally run internal or external JavaScript code, based on one or more conditions you have defined with the visitor data properties.
How Does It Work?
Geoflow evaluates the conditions defined in the Geo Script data attribute against the visitor data properties. If the conditions match (returns true), the internal or external JavaScript code will run. Otherwise, it will be left as-is and the code won't run.
By default, Geoflow will run the code if any conditions you have defined match (return true). You can override this default behaviour by applying the Geo Match data attribute.
How To Implement
Attribute Name | Attribute Value | Which Page Element? |
---|---|---|
type* | text/geoflow | <script> |
data-geo-script* | conditionName:conditionValue | <script> |
data-geo-match | all | Any element with the Geo Script data attribute. |
The type attribute is required to prevent the browser from automatically running the JS.
The condition name is case-sensitive and must match the 'Property Variable' for that visitor data property in the Visitor Data Properties table.
The case sensitivity and validity for the condition value depend on the data type. For example, when defining a condition based on a country code, the value must be an ISO Alpha-2 Code.
Any value other than 'all' added for the Geo Match data attribute will have no effect.
*โโโโ โAttribute names with a red asterisk are required; all others listed in the table are optional.
Example
Last updated
Was this helpful?