Installation Instructions (Deprecated)
Install this generalized code just above the closing</body> tag of your website.
networkId and numberSelector to match your Invoca Network and current web page settings.
Note:
You may find your networkId pre-populated in sample code available in the Invoca platform:
Choose Tools gear and select Web Integration.
Requirements
- Network is PNAPI enabled.
- RingPools are type: “Custom”.
- Invoca Web Integration code installed on page.
- Phone numbers on webpage tagged with a shared numberSelector class (Accepts multiple slectors).
- An Invoca Campaign ID to associate with each number on the page (Or a Campaign ID Override).
Identifying a Campaign
There are three methods to identify an Invoca Campaign on your web page, which follow an order of precedence. 1. campaignIdOverrideParam: Specify a query string parameter’s name, the value of which will be used as the Invoca Campaign ID for all phone numbers in a given session. 2. destinationAsId: When true, the phone number’s digits (special characters stripped) from thenumberSelector will be used as the Campaign ID.
3. data-invoca-campaign-id: When no override is passed, a user may assign individual Invoca Campaign IDs to a specific phone number’s HTML element using the data-invoca-campaign-id attribute.
4. defaultCampaignId: With no override, a defaultCampaignId can be passed to the Invoca.PNAPI.integration settings and will fill in the gaps wherever no data-invoca-campaign-id is found. If there are no data attributes or overrides, this value will apply to all phone numbers on the page.
Additionally, the defaultCampaignId can be assigned dynamically with JavaScript based upon the page’s environment and variables.
Client Side Parameters
Note: Any parameter value can be populated with a JavaScript variable.Required parameters: | ||
|---|---|---|
networkId | String | Invoca Network ID |
Required: One of the following | ||
|---|---|---|
numberSelector | String | CSS selector for phone number HTML elements Accepts one or many like so |
numberToReplace | String or Hash | Default: Specify which number(s) to replace. Can accept one or many like so:
|
Optional parameters: | ||
|---|---|---|
autoRun | Bool | Default determines whether Invoca’s web integration runs when the page loads. If you have a single page application and would like to control when Invoca’s web integration runs, set autoRun to false and call Note: autoRun does not have to be false in order to call |
destinationAsId | Bool | Default Strips out any special characters and uses found destination phone number’s digits as campaign ID. Warning! Requires Invoca campaign with explicit ID for each number. |
campaignIdOverrideParam | String | Default: Query string name used to identify Campaign ID |
poolParams | Hash | Default: Set of JavaScript parameters to be captured where the key name should be RingPool parameter name. These values are updated every subsequent visit. |
updatePoolParams | Bool | Default: When |
requiredParams | Hash | Default: A hash of key value pairs that represent query string names and values. For example: When a requiredParam’s value is |
cookieNames | Array | Default: List of cookie names to automatically capture as RingPool Parameters |
telLinkOnly | Bool | Default: Used for a “Call Now” button. When true, will only update the tel: link on any |
cookieDays | Int | Default: Number of days for cache TTL. |
onComplete | Function | Default: Arguments: Name of a function to call when Invoca has finished running. This is called after Invoca has run the default number replacement code and swapped out any numbers that were found. For example: |
onCompleteOverride | Function | Default: Arguments: Name of a function to call when Invoca has finished running. If defined, Invoca will not replace any phone numbers. This function is responsible for updating phone numbers on the web page as the default number replacement code will not be run. For example: |
debugMode | Boolean | Default: When true, will display debug logs in the developer console. |
Examples
campaignIdOverrideParam
To use a query string parameter as the Invoca Campaign ID for all phone numbers found on page, specify the parameter name in this option. To use the value of?utm_source as the Campaign ID, follow this example:
URL
http://www.example-page.com?utm_source=google
CODE
data-invoca-campaign-id’s and the defaultCampaignId being overriden.
data-invoca-campaign-id
To assign multiple numbers on a page to different Invoca Campaign IDs, simply add this attribute to each phone number element. URL http://www.example-page.com?utm_source=google CODEdefaultCampaignId
When no campaignIdOverride or data-invoca-campaign-id are found, the default campaign ID will be assigned to the call. CODEpoolParams
Allows variables from JavaScript to be associated with a call. CODErequiredParams
Conditionally runs Invoca’s web integration. URL #1 http://www.example-page.com?gclid=1a2b3c4d5e URL #2 http://www.example-page.com?ref=test CODEInvoca.PNAPI.run()
ReactMigrating from an older version
If you are migrating from SolutionsJS 1.2 or below, please refer to the following guide. 1. Update your namespaces - ChangeSolutions.PNAPI.integration to Invoca.PNAPI.integration - Change any Toolkit functions, like Solutions.PNAPI.readUrl to Invoca.Tools.readUrl
More on the Solutions Toolkit2. Update your data attributes - Change
data-invoca to data-invoca-campaign-id
- Update your integration scripts from this: