# Install GeoEngage on WordPress

> Add the GeoEngage tag to WordPress with a header-code plugin or your theme, and keep caching plugins from delaying it.

WordPress builds `<head>` from your theme, so the tag goes in through a plugin that adds header code, or through the theme itself. Use one of the two.

## Option 1: a header-code plugin

The simplest route if you don't edit theme files. With **WPCode** (formerly *Insert Headers and Footers*):

1. Install and activate WPCode from the WordPress plugin directory.
2. Open **Code Snippets → Header & Footer**.
3. Paste the tag into the **Header** box and choose **Save Changes**.

```html
<!-- GeoEngage — place in <head>, above your content.
     Do not add async/defer: the widget must run before the page paints. -->
<script
  src="https://cdn.geoengage.app/ge.js"
  data-api-key="YOUR_API_KEY"
  data-require-consent="false"
></script>
```

## Option 2: your theme

For developers. Add this to your child theme's `functions.php`, where a theme update won't overwrite it:

```php title="functions.php"
add_action('wp_head', function () {
    ?>
    <script
      src="https://cdn.geoengage.app/ge.js"
      data-api-key="YOUR_API_KEY"
      data-require-consent="false"
    ></script>
    <?php
}, 1);
```

Priority `1` prints the tag before the rest of the `wp_head` output.

## Caching and optimization plugins

Plugins that speed up WordPress often **delay**, **defer** or **combine** JavaScript, and any of the three runs the widget too late. In WP Rocket, LiteSpeed Cache, Autoptimize, SiteGround Optimizer and similar plugins, add the tag's URL to each of those exclusion lists:

```text
https://cdn.geoengage.app/ge.js
```

Then clear the plugin's page cache, so visitors get pages that include the tag.

## Check it's working

Open your site in a private window, then follow [the checks](https://geoengage.app/docs/install#check-its-working).

---

Source: https://geoengage.app/docs/install/wordpress
