🌎
Geoflow Docs
  • 🌎Welcome to Geoflow
  • 🔍Overview
    • Visitor Data Properties
  • ⭐Features
    • Geo Visibility
      • Define Multiple Conditions
      • Match All Conditions
      • Partially Match Condition
      • Reverse Condition Value
      • Custom Classes
    • Geo Form
      • Autofill Form Fields
      • Auto-Populate Select Fields
    • Geo Text
    • Geo Style
    • Geo Script
    • Script Extensions
      • Performance
      • Marketing Parameters
    • Optional Settings
      • Script Tag Data Attributes
      • Meta Tags
  • ⚙️Advanced
    • Code Snippets
    • Methods
      • run
      • getData
      • updateData
      • displayData
      • clearData
      • checkCondition
      • select
    • Callbacks
    • Events
    • REST API
      • Get Visitor IP
      • Get Visitor Data
      • Add Website
      • Delete Website
      • Update Website
      • List Websites
      • Get Website
  • 📄Legal
    • License Agreement
Powered by GitBook
  1. Features

Geo Script

Conditionally run internal or external JavaScript code, based on one or more conditions you have defined with the visitor data properties.

Last updated 1 year ago

Was this helpful?

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 .

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 .

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

<!--
If the Visitor Is NOT In the EU, The Cookie Banner Will Be Removed
-->
<script type="text/geoflow" data-geo-script="isEU:false">

    document.getElementById('cookie-banner')?.remove();

</script>
Visitor Data Properties table
ISO Alpha-2 Code
⭐
Page cover image