Invoca Tag Revisions¶
Manage Invoca Tag Revisions¶
The Invoca Tag Revisions allow you to keep a history of changes made to your Tag configuration. Additionally, you are able to make draft revisions, allowing you to test changes before deploying them.
This API documentation helps provide necessary features to create and manage Invoca Tag Revisions.
Property |
Type |
Value |
---|---|---|
external_revision_id |
string (read-only) |
The current recent revision id if live or nil if draft. |
allow_overflow |
boolean (default false) |
Reserve one phone number for “overflow” and apply to any additional visitors. |
auto_create_local_ringpools |
boolean (default false) |
Auto create a ring pool with local numbers |
auto_create_toll_free_ringpools |
boolean (default false) |
Auto create a ring pool with toll free numbers |
auto_swap |
boolean (default false) |
Set to true if you want the Invoca JS to automatically detect and replace all numbers on page. This can be useful if you have a large list of phone numbers to manage, or don’t know all of the numbers listed across your site. If true, number_selector and number_to_replace are not needed. |
body |
string |
Response body of the JS Tag to be added to the site |
cache_lifetime_days |
integer (default 30) |
This setting determines how long Invoca identifies a visitor to your landing page as a unique visitor. By default, your Tag’s attribution window is set to 30 days. |
custom_code |
string |
The custom code is a scoped function to insert any custom JavaScript to manipulate the options config that will be passed into the Invoca Integration. |
custom_data_fields |
array of objects |
Marketing data fields |
custom_data_fields[].enabled |
boolean |
Status of the marketing data field. |
custom_data_fields[].partner_name |
string |
Marketing data field name. |
custom_data_fields[].friendly_name |
string |
Marketing data field friendly name. |
custom_data_fields[].attribution_model |
string |
Marketing data field model type. |
custom_data_fields[].data_source_type |
string |
Data source for the marketing data field. |
custom_data_fields[].data_source_name |
string |
Friendly name for the marketing data field. |
default_campaign |
object |
Default campaign for the all numbers found except for ones in numbers_to_replace and numbers_to_not_replace configurations. |
default_campaign.default_campaign_id |
integer |
Internal campaign id of the default campaign. TBD: SHOULD THIS BE UPDATED TO advertiser_campaign_id_from_network. |
default_campaign.default_campaign_name |
string |
Name of the default campaign |
destination_param |
string |
Destination key for dynamic routing. |
message |
string |
Auto-generated or user defined note for the revision. |
numbers_to_replace |
array of objects |
Specify which number(s) to replace and what campaign ID to use for each number. |
numbers_to_replace[].phone_number |
string |
Phone number to be replaced. |
numbers_to_replace[].phone_number_e164 |
string |
E.164 version of the phone number to be replaced. |
numbers_to_replace[].advertiser_campaign_id |
integer |
Id of the advertiser campaign to be used for the above phone number. TBD: REMOVE THIS KEY |
numbers_to_replace[].advertiser_campaign_name |
string |
Name of the advertiser campaign for the above phone number. |
numbers_to_replace[].advertiser_campaign_id_from_network |
string |
Id of the advertiser campaign to be used for the above phone number. |
numbers_to_replace[].destinations_enabled |
boolean |
If the linked advertiser campaign has destinations settings. |
numbers_to_not_replace |
array of objects |
Specify which number(s) to not replace. |
numbers_to_not_replace[].phone_number |
string |
Phone number to not be replaced. |
numbers_to_not_replace[].phone_number_e164 |
string |
E.164 version of the phone number to not be replaced. |
numbers_to_not_replace[].destinations_enabled |
boolean (read-only) |
Always false. |
organic_sources |
boolean |
If you receive organic traffic to your landing page, enabling this will fill in your utm marketing parameters with a default value to record that organic attribution. |
re_run_attribution_after |
integer |
Number of seconds after which Invoca tag makes another attempt at capturing Marketing Data. This allows your Tag to swap in Invoca Promo Numbers immediately, but still capture parameters that may be slower to load. |
required_params |
string |
Comma-separated list of parameters required to trigger Invoca Tag. Invoca will look for these parameter names in your visitor’s browser session and will only run your tag if these parameters are present or if there is an exact match for a URL parameter in the format ‘parameter=value’. |
reset_cache_on |
string |
This is a list of the Marketing Data parameters Invoca uses to determine attribution for your paid search ads. By default, Invoca uses “gclid”, “utm_source”, and “utm_medium” for this setting. If any of these parameters change in a visitor’s browser session, Invoca will reset all attribution for that site visitor. |
wait_for_in_seconds |
string |
Number of seconds by which to delay Invoca tag from running. This allows your Invoca Tag to run after your other vendors or user interactions, but may make the swap on your landing page to Invoca Promo Numbers visible to your visitors. |
is_draft_revision |
boolean (read-only) |
Identifier to get to find if the revision is draft |
is_live_revision |
boolean (read-only) |
Identifier to get to find if the revision is live |
Endpoint:
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions.json
Note: when working with a Draft Revision, the <external_revision_id> should be set to draft in the URL.
Examples
Read all Invoca Tag Revisions
Endpoint:
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions.json
Response Code: 200
Response Body:
{
"data": [
{
"allow_overflow": false,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": false,
"body": "(function(networkId) {\nvar automaticIntegrations = {};\n\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [];\n\nvar customDataWaitForConfigAnonymousFunctions = [];\n\nvar defaultCampaignId = null;\n\nvar destinationSettings = {\n paramName: null\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = null;\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n console.log('Invoca Tag paused at 11/06/23 8:26 AM');\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: false,\n cookieDays: cacheLifetimeDays,\n country: null,\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: [],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig,\n waitForDataAnonymousFunctions: customDataWaitForConfigAnonymousFunctions\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
"cache_lifetime_days": 30,
"cache_lifetime_warning": null,
"created_at": "2023-11-06T04:10:51-08:00",
"custom_code": "console.log('Invoca Tag paused at 11/06/23 8:26 AM');",
"custom_data_fields": [],
"default_campaign": {},
"destination_param": null,
"external_revision_id": 0,
"is_draft_revision": false,
"is_live_revision": true,
"js_tag_id": "0054811245",
"message": "Auto-generated initial revision",
"numbers_to_not_replace": [],
"numbers_to_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-06T08:55:11-08:00",
"wait_for_in_seconds": 0,
"warning": null
},
{
"allow_overflow": false,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": true,
"body": "(function(networkId) {\nvar cacheLifetimeDays = 7;\n\nvar customDataWaitForConfig = [\n { on: function() { return Invoca.Client.parseCustomDataField(\"landing_page\", \"Unique\", \"URLParam\", \"\"); }, paramName: \"landing_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"line_of_business\", \"Unique\", \"URLParam\", \"\"); }, paramName: \"line_of_business\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"offer\", \"Unique\", \"URLParam\", \"\"); }, paramName: \"offer\", fallbackValue: null }\n];\n\nvar customDataWaitForConfigAnonymousFunctions = [];\n\nvar defaultCampaignId = \"84\";\n\nvar destinationSettings = {\n paramName: null\n};\n\nvar numbersToReplace = {\n \"44454545557\": \"83\"\n};\n\nvar organicSources = true;\n\nvar reRunAfter = 5000;\n\nvar requiredParams = {\"gclid\":\"*\",\"utm_medium\":\"*\",\"utm_source\"=\"organic\"};\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n return options;\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: true,\n cookieDays: cacheLifetimeDays,\n country: \"US\",\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: [],\n doNotSwap: [\"888-676-5565\"],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig,\n waitForDataAnonymousFunctions: customDataWaitForConfigAnonymousFunctions\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
"cache_lifetime_days": 7,
"cache_lifetime_warning": null,
"created_at": "2023-11-06T04:10:51-08:00",
"custom_code": "",
"custom_data_fields": [
{
"enabled": true,
"partner_name": "landing_page",
"friendly_name": "Landing Page",
"attribution_model": "Unique",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "line_of_business",
"friendly_name": "Line of Business",
"attribution_model": "Unique",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "offer",
"friendly_name": "Offer",
"attribution_model": "Unique",
"data_source_type": "URLParam",
"data_source_name": ""
}
],
"default_campaign": {
"default_campaign_id": 84,
"default_campaign_name": "Campaign for NY"
},
"destination_param": null,
"external_revision_id": null,
"is_draft_revision": true,
"is_live_revision": false,
"js_tag_id": "0054811245",
"message": "updated note",
"numbers_to_not_replace": [
{
"phone_number": "888-676-5565",
"phone_number_e164": "+18886765565",
"destinations_enabled": false
}
],
"numbers_to_replace": [
{
"phone_number": "44454545557",
"phone_number_e164": "44454545557",
"advertiser_campaign_id": 83,
"advertiser_campaign_name": "Campaign for Manhattan",
"advertiser_campaign_id_from_network": "83",
"destinations_enabled": false
}
],
"organic_sources": true,
"re_run_attribution_after": 5,
"required_params": "gclid,utm_medium,utm_source=organic",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-07T02:41:33-08:00",
"wait_for_in_seconds": 0,
"warning": null
}
],
"requestId": null,
"recordsTotal": 2
"start": 0
}
Examples
Read an Invoca Tag Revision
Endpoint:
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions/<external_revision_id>.json
Response Code: 200
Response Body:
{
"allow_overflow": true,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": false,
"body": "(function(networkId) {\nvar automaticIntegrations = {};\n\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [];\n\nvar customDataWaitForConfigAnonymousFunctions = [];\n\nvar defaultCampaignId = null;\n\nvar destinationSettings = {\n paramName: null\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = {\"gclid\":\"*\",\"utm_source\":\"linkedin_company\",\"utm_medium\":\"email\"};\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n console.log('Invoca Tag paused at 11/06/23 8:26 AM');\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: false,\n cookieDays: cacheLifetimeDays,\n country: null,\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: [],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig,\n waitForDataAnonymousFunctions: customDataWaitForConfigAnonymousFunctions\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
"cache_lifetime_days": 30,
"cache_lifetime_warning": null,
"created_at": "2023-11-06T04:10:51-08:00",
"custom_code": "console.log('Invoca Tag paused at 11/06/23 8:26 AM');",
"custom_data_fields": [],
"default_campaign": {},
"destination_param": null,
"external_revision_id": 0,
"is_draft_revision": false,
"is_live_revision": true,
"js_tag_id": "0054811245",
"message": "Auto-generated initial revision",
"numbers_to_replace": [],
"numbers_to_not_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "gclid,utm_source=linkedin_company,utm_medium=email",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-06T08:55:11-08:00",
"wait_for_in_seconds": 0,
"warning": null
}
Examples
Create a new Draft Tag Revision
Endpoint:
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions.json
Format: application/json
Request Body:
{
"allow_overflow": false,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": true,
"body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [\n { on: function() { return Invoca.Client.parseCustomDataField(\"calling_page\", \"Last\", \"JavascriptDataLayer\", \"location.hostname + location.pathname\"); }, paramName: \"calling_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"gclid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"gclid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"g_cid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"g_cid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"landing_page\", \"First\", \"JavascriptDataLayer\", \"location.href\"); }, paramName: \"landing_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"msclkid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"msclkid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_campaign\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_campaign\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_content\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_content\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_medium\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_medium\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_medium || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_source\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_source\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_source || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"wbraid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"wbraid\", fallbackValue: null }\n];\n\nvar defaultCampaignId = \"87\";\n\nvar destinationSettings = {\n paramName: \"invoca_detected_destination\"\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = null;\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n return options;\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: true,\n cookieDays: cacheLifetimeDays,\n country: \"US\",\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: [],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(29);\n",
"cache_lifetime_days": 30,
"cache_lifetime_warning": null,
"created_at": "2023-11-15T08:01:36-08:00",
"custom_code": "",
"custom_data_fields": [
{
"enabled": false,
"partner_name": "calling_page",
"friendly_name": "Calling Page",
"attribution_model": "Last",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.hostname + location.pathname"
},
{
"enabled": false,
"partner_name": "gclid",
"friendly_name": "Google Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": false,
"partner_name": "g_cid",
"friendly_name": "Google Analytics Client ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "landing_page",
"friendly_name": "Full Landing Page URL",
"attribution_model": "First",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.href"
},
{
"enabled": true,
"partner_name": "msclkid",
"friendly_name": "Microsoft Ads Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_campaign",
"friendly_name": "Marketing Campaign",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_content",
"friendly_name": "Marketing Content",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_medium",
"friendly_name": "Marketing Medium",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_source",
"friendly_name": "Marketing Source",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "wbraid",
"friendly_name": "Google WBRAID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
}
],
"default_campaign": {
"default_campaign_id": "87",
"default_campaign_name": "Default: Default Call Treatment"
},
"js_tag_id": "2510358551",
"message": "default message",
"numbers_to_not_replace": [],
"numbers_to_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "gclid,fbclid,utm_medium=programmatic-audio",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-15T08:01:36-08:00",
"wait_for_in_seconds": 0.0,
"warning": null
}
Response Code: 201
Response Body:
{
"allow_overflow": false,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": true,
"body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [\n { on: function() { return Invoca.Client.parseCustomDataField(\"landing_page\", \"First\", \"JavascriptDataLayer\", \"location.href\"); }, paramName: \"landing_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"msclkid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"msclkid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_campaign\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_campaign\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_content\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_content\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_medium\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_medium\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_medium || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_source\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_source\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_source || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"wbraid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"wbraid\", fallbackValue: null }\n];\n\nvar defaultCampaignId = null;\n\nvar destinationSettings = {\n paramName: \"invoca_detected_destination\"\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = null;\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n return options;\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: true,\n cookieDays: cacheLifetimeDays,\n country: null,\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: ['calling_page','gclid','g_cid'],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(29);\n",
"cache_lifetime_days": 30,
"cache_lifetime_warning": null,
"created_at": "2023-11-15T12:07:28-08:00",
"custom_code": "",
"custom_data_fields": [
{
"enabled": false,
"partner_name": "calling_page",
"friendly_name": "Calling Page",
"attribution_model": "Last",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.hostname + location.pathname"
},
{
"enabled": false,
"partner_name": "gclid",
"friendly_name": "Google Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": false,
"partner_name": "g_cid",
"friendly_name": "Google Analytics Client ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "landing_page",
"friendly_name": "Full Landing Page URL",
"attribution_model": "First",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.href"
},
{
"enabled": true,
"partner_name": "msclkid",
"friendly_name": "Microsoft Ads Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_campaign",
"friendly_name": "Marketing Campaign",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_content",
"friendly_name": "Marketing Content",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_medium",
"friendly_name": "Marketing Medium",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_source",
"friendly_name": "Marketing Source",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "wbraid",
"friendly_name": "Google WBRAID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
}
],
"default_campaign": {},
"destination_param": "invoca_detected_destination",
"external_revision_id": null,
"is_draft_revision": true,
"is_live_revision": false,
"js_tag_id": "2510358551",
"message": "",
"numbers_to_not_replace": [],
"numbers_to_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "gclid,fbclid,utm_medium=programmatic-audio",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-15T12:07:28-08:00",
"wait_for_in_seconds": 0.0,
"warning": null
}
Examples
Update an existing Draft Tag Revision
Endpoint:
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions/draft.json
Format: application/json
Request Body:
{
"allow_overflow": false,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": false,
"body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [\n { on: function() { return Invoca.Client.parseCustomDataField(\"calling_page\", \"Last\", \"JavascriptDataLayer\", \"location.hostname + location.pathname\"); }, paramName: \"calling_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"gclid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"gclid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"g_cid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"g_cid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"landing_page\", \"First\", \"JavascriptDataLayer\", \"location.href\"); }, paramName: \"landing_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"msclkid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"msclkid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_campaign\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_campaign\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_content\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_content\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_medium\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_medium\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_medium || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_source\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_source\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_source || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"wbraid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"wbraid\", fallbackValue: null }\n];\n\nvar defaultCampaignId = \"87\";\n\nvar destinationSettings = {\n paramName: \"invoca_detected_destination\"\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = null;\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n return options;\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: true,\n cookieDays: cacheLifetimeDays,\n country: \"US\",\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: [],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(29);\n",
"cache_lifetime_days": 30,
"cache_lifetime_warning": null,
"created_at": "2023-11-15T08:01:36-08:00",
"custom_code": "",
"custom_data_fields": [
{
"enabled": false,
"partner_name": "calling_page",
"friendly_name": "Calling Page",
"attribution_model": "Last",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.hostname + location.pathname"
},
{
"enabled": false,
"partner_name": "gclid",
"friendly_name": "Google Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": false,
"partner_name": "g_cid",
"friendly_name": "Google Analytics Client ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "landing_page",
"friendly_name": "Full Landing Page URL",
"attribution_model": "First",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.href"
},
{
"enabled": true,
"partner_name": "msclkid",
"friendly_name": "Microsoft Ads Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_campaign",
"friendly_name": "Marketing Campaign",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_content",
"friendly_name": "Marketing Content",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_medium",
"friendly_name": "Marketing Medium",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_source",
"friendly_name": "Marketing Source",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "wbraid",
"friendly_name": "Google WBRAID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
}
],
"default_campaign": {
"default_campaign_id": "87",
"default_campaign_name": "Default: Default Call Treatment"
},
"js_tag_id": "2510358551",
"message": "Set auto-swap to false",
"numbers_to_not_replace": [],
"numbers_to_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "gclid,st-t,utm_source=Bing",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-15T08:01:36-08:00",
"wait_for_in_seconds": 0.0,
"warning": null
}
Response Code: 200
Response Body:
{
"allow_overflow": false,
"auto_create_local_ringpools": false,
"auto_create_toll_free_ringpools": false,
"auto_swap": false,
"body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [\n { on: function() { return Invoca.Client.parseCustomDataField(\"landing_page\", \"First\", \"JavascriptDataLayer\", \"location.href\"); }, paramName: \"landing_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"msclkid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"msclkid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_campaign\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_campaign\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_content\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_content\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_medium\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_medium\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_medium || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_source\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_source\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_source || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"wbraid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"wbraid\", fallbackValue: null }\n];\n\nvar defaultCampaignId = null;\n\nvar destinationSettings = {\n paramName: \"invoca_detected_destination\"\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = null;\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n return options;\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: true,\n cookieDays: cacheLifetimeDays,\n country: null,\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: ['calling_page','gclid','g_cid'],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(29);\n",
"cache_lifetime_days": 30,
"cache_lifetime_warning": null,
"created_at": "2023-11-15T12:07:28-08:00",
"custom_code": "return options;",
"custom_data_fields": [
{
"enabled": false,
"partner_name": "calling_page",
"friendly_name": "Calling Page",
"attribution_model": "Last",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.hostname + location.pathname"
},
{
"enabled": false,
"partner_name": "gclid",
"friendly_name": "Google Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": false,
"partner_name": "g_cid",
"friendly_name": "Google Analytics Client ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "landing_page",
"friendly_name": "Full Landing Page URL",
"attribution_model": "First",
"data_source_type": "JavascriptDataLayer",
"data_source_name": "location.href"
},
{
"enabled": true,
"partner_name": "msclkid",
"friendly_name": "Microsoft Ads Click ID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_campaign",
"friendly_name": "Marketing Campaign",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_content",
"friendly_name": "Marketing Content",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_medium",
"friendly_name": "Marketing Medium",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "utm_source",
"friendly_name": "Marketing Source",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
},
{
"enabled": true,
"partner_name": "wbraid",
"friendly_name": "Google WBRAID",
"attribution_model": "Last",
"data_source_type": "URLParam",
"data_source_name": ""
}
],
"default_campaign": {},
"destination_param": "invoca_detected_destination",
"external_revision_id": null,
"is_draft_revision": true,
"is_live_revision": false,
"js_tag_id": "2510358551",
"message": "Set auto-swap to false",
"numbers_to_not_replace": [],
"numbers_to_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "gclid,st-t,utm_source=Bing",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"updated_at": "2023-11-15T12:07:28-08:00",
"wait_for_in_seconds": 0.0,
"warning": null
}
Examples
Delete a Draft Tag Revision
Endpoint:
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions/draft.json
Format: application/json
Response Code: 200
Response Body:
{}
Error Handling¶
Forbidden – 403:
POST¶
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions.json
Content Type: application/json
Response Code: 403
Request Body
{
"cache_lifetime_days": 3000,
"body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [\n { on: function() { return Invoca.Client.parseCustomDataField(\"calling_page\", \"Last\", \"JavascriptDataLayer\", \"location.hostname + location.pathname\"); }, paramName: \"calling_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"gclid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"gclid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"g_cid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"g_cid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"landing_page\", \"First\", \"JavascriptDataLayer\", \"location.href\"); }, paramName: \"landing_page\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"msclkid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"msclkid\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_campaign\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_campaign\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_content\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_content\", fallbackValue: null },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_medium\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_medium\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_medium || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"utm_source\", \"Last\", \"URLParam\", \"\"); }, paramName: \"utm_source\", fallbackValue: function() { return Invoca.PNAPI.currentPageSettings.poolParams.utm_source || null; } },\n { on: function() { return Invoca.Client.parseCustomDataField(\"wbraid\", \"Last\", \"URLParam\", \"\"); }, paramName: \"wbraid\", fallbackValue: null }\n];\n\nvar defaultCampaignId = \"87\";\n\nvar destinationSettings = {\n paramName: \"invoca_detected_destination\"\n};\n\nvar numbersToReplace = null;\n\nvar organicSources = true;\n\nvar reRunAfter = null;\n\nvar requiredParams = null;\n\nvar resetCacheOn = ['gclid', 'utm_source', 'utm_medium'];\n\nvar waitFor = 0;\n\nvar customCodeIsSet = (function() {\n Invoca.Client.customCode = function(options) {\n return options;\n };\n\n return true;\n})();\n\nvar generatedOptions = {\n active: true,\n autoSwap: true,\n cookieDays: cacheLifetimeDays,\n country: \"US\",\n dataSilo: \"us\",\n defaultCampaignId: defaultCampaignId,\n destinationSettings: destinationSettings,\n disableUrlParams: [],\n doNotSwap: [],\n maxWaitFor: waitFor,\n networkId: networkId || null,\n numberToReplace: numbersToReplace,\n organicSources: organicSources,\n poolParams: {},\n reRunAfter: reRunAfter,\n requiredParams: requiredParams,\n resetCacheOn: resetCacheOn,\n waitForData: customDataWaitForConfig\n};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(29);\n",
"cache_lifetime_warning": null,
"created_at": "2023-11-15T08:01:36-08:00",
"custom_code": "",
"custom_data_fields": [],
"default_campaign": {
"default_campaign_id": "87",
"default_campaign_name": "Default: Default Call Treatment"
},
"js_tag_id": "2510358551",
"message": "",
"numbers_to_not_replace": [],
"numbers_to_replace": [],
"organic_sources": true,
"re_run_attribution_after": null,
"required_params": "",
"reset_cache_on": [
"gclid",
"utm_source",
"utm_medium"
],
"wait_for_in_seconds": 0.0
}
Response Body
{
"errors": {
"cache_lifetime_days": [
"must be less than or equal to 30 days",
"must be one of [1, 7, 14, 30]"
]
}
}
PUT¶
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions/1.json
Content Type: application/json
Response Code: 403
Request Body
Response Body
{
"errors": {
"class": "RecordInvalid",
"invalid_data": "Validation failed: This action can only be applied to the draft revision"
}
}
DELETE¶
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions/1.json
Content Type: application/json
Response Code: 403
Response Body
{
"errors": {
"class": "RecordInvalid",
"invalid_data": "Validation failed: This action can only be applied to the draft revision"
}
}
Not Found – 404:
GET¶
https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revisions/<external_revision_id>.json
Content Type: application/json
Response Code: 404
Response Body
{
"errors": {
"class": "RecordNotFound",
"invalid_data": "Invoca Tag Revision not found with revision id: '99999'"
}
}