# Geo Script

### 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

<table><thead><tr><th>Attribute Name</th><th width="266.3333333333333">Attribute Value</th><th>Which Page Element?</th></tr></thead><tbody><tr><td>type<mark style="color:red;">*</mark></td><td>text/geoflow</td><td>&#x3C;script></td></tr><tr><td>data-geo-script<mark style="color:red;">*</mark></td><td>conditionName:conditionValue</td><td>&#x3C;script></td></tr><tr><td>data-geo-match</td><td>all</td><td>Any element with the <strong>Geo Script</strong> data attribute.</td></tr></tbody></table>

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](/geoflow-docs/overview/visitor-data-properties.md).

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](https://www.iso.org/obp/ui/#search/code/).

Any value other than 'all' added for the Geo Match data attribute will have no effect.

<mark style="color:red;">\*</mark>‎‏‏‎ ‎Attribute names with a red asterisk are required; all others listed in the table are optional.

### Example

```html
<!--
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>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.getgeoflow.com/geoflow-docs/feature/script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
