A brief flicker of the original phone number before it swaps is caused by the Invoca Tag’s asynchronous loading — hide it with custom code that reveals the number only once swapping completes.
Symptoms
When a webpage loads, the hardcoded site phone number briefly appears before Dynamic Number Insertion swaps it with an Invoca number, creating a flickering effect. Applies to: Accounts using the Invoca Tag for Dynamic Number Insertion on their webpages.Cause
Number flicker can be caused by the asynchronous loading of the Invoca Tag JavaScript on a site. JavaScript commands run one after another, and the Invoca Tag is set to run after the commands that load the phone number onto the page.Resolution
This solution requires development on the customer’s part, within their own codebase.- If you’re using an Invoca
numberSelector, target that CSS selector in the next step. Otherwise, create a new CSS class for phone numbers on your page — the example below uses.InvocaNumber. - Insert the following code in the custom code block of your Invoca Tag Wizard:
onComplete: covers the normal case — showing the number by updating its style as soon as the tag returns with a DNI number and swaps it in.setTimeout: a fallback for cases where the tag doesn’t run, or there’s an error reaching the Invoca server (soonCompletenever fires) — this ensures the container showing the number still displays the original number.