> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invoca.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Re-Run the Invoca Tag in Google Tag Manager

> Manually trigger a re-scan with `Invoca.PNAPI.run()` when phone numbers load dynamically after the initial page load, using a GTM Element Visibility Trigger.

By default, the Invoca Tag runs automatically on initial page load. Many modern websites load content dynamically afterward — for example, via AJAX or single-page app transitions. This guide covers making sure Invoca can still find and replace phone numbers in that dynamically loaded content, using Google Tag Manager (GTM).

## Step 1: Create an Element Visibility Trigger

1. In Google Tag Manager, go to **Triggers**, then **New**.
2. Choose **Trigger Configuration**, then the **Element Visibility** type.
3. Under Selection Method, choose **ID** or **CSS Selector**.
4. In the Element Selector field, enter the identifier for the dynamically loaded element:
   * ID: `#your-element-id`
   * CSS Class: `.your-class-name`
   * Attribute: `[data-invoca-target="true"]`
   * HTML tag name (like `main`, `header`, or `footer`): just the word itself, with no dots or hashes
5. Set the trigger to fire **every time an element appears on-screen**.
6. Check **Observe DOM changes**, so the trigger can track elements that appear as the page's structure changes dynamically.
7. Name the trigger clearly (for example, "Invoca Re-Scan Trigger - Dynamic Component").

## Step 2: Create a Custom HTML Tag

1. In GTM, go to **Tags**, then **New**.
2. Choose **Tag Configuration**, then the **Custom HTML** type.
3. Paste the following:

```html theme={null}
<script>
  // Check if the Invoca object exists before attempting the run command
  if (window.Invoca) {
    Invoca.PNAPI.run();
  }
</script>
```

4. Under Triggering, select the Element Visibility Trigger from Step 1.
5. Name the tag clearly (for example, "Invoca PNAPI Re-Run").
6. Save the tag and publish your GTM container changes.

## Step 3: Verify the firing

1. Open your website in GTM Preview Mode.
2. Trigger the action that makes the dynamic component appear.
3. Look for the "Element Visibility" event in the summary pane.
4. Click the event and confirm your "Invoca PNAPI Re-Run" tag shows under "Tags Fired."
5. If the event fires but the tag shows "Not Fired," click into the tag to see which firing filter failed — usually an ID/CSS selector mismatch.

Once set up, the Invoca Tag re-scans the page whenever the target element becomes visible, so it can find and replace any phone numbers in that new content.

## Where to go next

* [The Invoca Tag for Dynamic Content Loading Pages and Single Page Applications](/s/article/tag-dynamic-content-spa)
* [Single Page App (SPA) Support](/s/article/spa-support)
* [Validating and Troubleshooting Your Tags](/s/article/validating-troubleshooting-tags)
