Skip to main content
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:
  1. Under Triggering, select the Element Visibility Trigger from Step 1.
  2. Name the tag clearly (for example, “Invoca PNAPI Re-Run”).
  3. 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

Last modified on September 25, 2026