Skip to main content
Because the Invoca Tag fires on initial page load, content that loads dynamically afterward — lazy-loaded sections, search results, or SPA view changes — needs the Tag to run again to catch new phone numbers.
It’s increasingly common for websites to load partial content dynamically instead of refreshing the entire page — for example, when a visitor clicks a button or scrolls for more content. Modern web pages often rewrite only the necessary sections rather than loading an entirely new page. This is known as a Single Page Application (SPA): a page refresh never occurs, and resources load dynamically in response to visitor actions. Because the Invoca Tag fires and swaps numbers during the initial page load, visitors may still see the original phone number instead of the Invoca number when new content loads dynamically afterward. To track and attribute those calls accurately, the Tag needs to run again at the right time to catch any additional numbers that appear.

Common cases where this happens

Dynamic resource loading (e.g., a “Find a Location” search). A visitor searches for nearby services, and a list of results with their own phone numbers appears — those numbers can display as the original, unswapped numbers. Lazy loading. To improve page speed, many sites load content only as it’s needed — for example, showing the first few items in a list, then loading more as the visitor scrolls. If a lazily loaded section includes phone numbers, visitors may see the original number. Pages built with components. Many modern pages assemble a header, sidebar, content sections, and footer as separate components, each rendering part of the page’s DOM. If the Invoca Tag script runs before all components have mounted, visitors may still see the original phone number.

How the Tag works

Placing the Invoca Tag immediately before the closing </body> tag is recommended so it can collect the original phone number, replace it with a trackable one, and render the page with the update in place. When a browser parses HTML, it builds a DOM tree — but when it hits a <script> tag, it pauses to fetch and run that script before continuing. Placing the Tag right before </body> means the rest of the page’s HTML (and its phone numbers) is already available for the Tag to find and swap.

Best practice

By default, the Invoca Tag runs automatically as soon as the tag snippet loads. Decide first whether your Tag will run on traditional pages, SPA pages, or both: SPA pages only: use one tag with options.autoRun = false in the custom code section. This prevents Invoca from running until explicitly triggered by Invoca.PNAPI.run().
Both SPA and traditional pages: you have two options:
  1. Deploy two separate tags — one for SPA pages with autoRun = false, and one for traditional pages using the default (true).
  2. Deploy a single hybrid tag with autoRun = true, so numbers replace normally on traditional pages, and separately call Invoca.PNAPI.run() natively on SPA pages (outside the Invoca tag, after the standard script has loaded). This re-runs the Tag, detects numbers, and requests a new swap for anything found. You can call this method multiple times as new content loads, keeping tracking and attribution accurate throughout the session.

Where to go next

Last modified on September 21, 2026