Invoca Tags

Manage Invoca Tags (aka JS Tags)

The Invoca Tag is a snippet of code that connects Invoca to your landing pages. This API documentation helps provide necessary features to create and manage an Invoca Tag and it’s revisions.

More details on the Invoca Tags can be found:

Property

Type

Value

id

integer (read-only)

The internal Invoca id of the Invoca Tag.

name

string

The name of the Invoca Tag. Unique within network.

description

string

Invoca Tag description.

landing_page_url

string

Website or page URL on which the destination is applied.

active

boolean

Current status of the Invoca Tag.

status

string

Current status.

created_at

string (read-only)

Alias for the destination. Auto-generated names.

live_revision

object

Current live revision.

draft_revision

object

Current draft revision.

Note: When viewing JS Tags, you will also be viewing their associated revisions. Below is a reference for the revision and its attributes. If you are looking to edit the revision itself, use the Tag Revision API instead.

JS Tag Revision

Revision for the JS Tag

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.json

Examples

Read all Invoca Tags as an array.

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags.json

Response Code: 200

Response Body:

{
  "data": [
    {
      "id": "0054811245",
      "name": "my first Invoca tag",
      "description": "This tag applies to Example.com",
      "landing_page_url": "example.com",
      "active": true,
      "status": "Live",
      "created_at": "2023-11-06 04:10:51 -0800",
      "updated_at": "2023-11-07 02:41:33 -0800",
      "live_revision":
      {
        "author": "Oauth API User",
        "allow_overflow": true,
        "auto_create_local_ringpools": false,
        "auto_create_toll_free_ringpools": false,
        "auto_swap": false,
        "body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [];\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
        "cache_lifetime_days": 30,
        "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": "",
        "reset_cache_on": [
          "gclid",
          "utm_source",
          "utm_medium"
        ],
        "cache_lifetime_warning": null,
        "updated_at": "2023-11-06T08:55:11-08:00",
        "wait_for_in_seconds": 0,
        "cache_lifetime_options": [
          1,
          7,
          14,
          30
        ],
        "warning": null
      },
      "draft_revision":
      {
        "author": "John Doe",
        "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 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\":\"*\"};\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
        "cache_lifetime_days": 7,
        "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_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
          }
        ],
        "numbers_to_not_replace": [
          {
            "phone_number": "888-676-5565",
            "phone_number_e164": "+18886765565",
            "destinations_enabled": false
          }
        ],
        "organic_sources": true,
        "re_run_attribution_after": 5,
        "required_params": "gclid,utm_medium",
        "reset_cache_on": [
          "gclid",
          "utm_source",
          "utm_medium"
        ],
        "cache_lifetime_warning": null,
        "updated_at": "2023-11-07T02:41:33-08:00",
        "wait_for_in_seconds": 0,
        "cache_lifetime_options": [
          1,
          7,
          14,
          30
        ],
        "warning": null
      }
    }
  ],
  "requestId": null,
  "recordsTotal": 1
}

Examples

Read an Invoca Tag

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>.json

Response Code: 200

Response Body:

{
  "id": "0054811245",
  "name": "my first Invoca tag",
  "description": "This tag applies to Example.com",
  "landing_page_url": "example.com",
  "active": true,
  "status": "Live",
  "created_at": "2023-11-06 04:10:51 -0800",
  "updated_at": "2023-11-07 02:41:33 -0800",
  "live_revision":
  {
    "author": "Oauth API User",
    "allow_overflow": true,
    "auto_create_local_ringpools": false,
    "auto_create_toll_free_ringpools": false,
    "auto_swap": false,
    "body": "(function(networkId) {\nvar cacheLifetimeDays = 30;\n\nvar customDataWaitForConfig = [];\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "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": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-06T08:55:11-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision":
  {
    "author": "John Doe",
    "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 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\":\"*\"};\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 7,
    "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_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
      }
    ],
    "numbers_to_not_replace": [
      {
        "phone_number": "888-676-5565",
        "phone_number_e164": "+18886765565",
        "destinations_enabled": false
      }
    ],
    "organic_sources": true,
    "re_run_attribution_after": 5,
    "required_params": "gclid,utm_medium",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T02:41:33-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  }
}

Examples

Create an Invoca Tag named “test for example.com”

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags.json

Format: application/json

Request Body:

{
  "name": "test for example.com",
  "description": "An example to show how it works"
}

Response Code: 201

Response Body:

{
  "id": "4225568320",
  "name": "test for example.com",
  "description": "An example to show how it works",
  "landing_page_url": "",
  "active": true,
  "status": "Live",
  "created_at": "2023-11-07 03:30:12 -0800",
  "updated_at": "2023-11-07 03:30:12 -0800",
  "live_revision": {
    "author": "Oauth API User",
    "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\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    return options;\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:30:12-08:00",
    "custom_code": "",
    "custom_data_fields": [],
    "default_campaign": {},
    "destination_param": null,
    "external_revision_id": 0,
    "is_draft_revision": false,
    "is_live_revision": true,
    "js_tag_id": "4225568320",
    "message": "Auto-generated initial revision",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:30:12-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision": {
    "author": "Oauth API User",
    "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\", \"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 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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:30:12-08:00",
    "custom_code": "console.log('Invoca Tag paused at 11/06/23   8:26 AM');",
    "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": {},
    "destination_param": null,
    "external_revision_id": null,
    "is_draft_revision": true,
    "is_live_revision": false,
    "js_tag_id": "4225568320",
    "message": "Auto-generated first draft",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:30:12-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  }
}

Examples

Update an Invoca Tag

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>.json

Format: application/json

Request Body:

{
  "name": "alpha-test for example.com",
  "description": "This is alpha phase test."
}

Response Code: 200

Response Body:

{
  "id": "4225568320",
  "name": "alpha-test for example.com",
  "description": "This is alpha phase test.",
  "landing_page_url": "",
  "active": true,
  "status": "Live",
  "created_at": "2023-11-07 03:30:12 -0800",
  "updated_at": "2023-11-07 03:39:38 -0800",
  "live_revision": {
    "author": "Oauth API User",
    "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\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    return options;\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:30:12-08:00",
    "custom_code": "",
    "custom_data_fields": [],
    "default_campaign": {},
    "destination_param": null,
    "external_revision_id": 0,
    "is_draft_revision": false,
    "is_live_revision": true,
    "js_tag_id": "4225568320",
    "message": "Auto-generated initial revision",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:30:12-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision": {
    "author": "Oauth API User",
    "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\", \"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 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    return options;\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:30:12-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": {},
    "destination_param": null,
    "external_revision_id": null,
    "is_draft_revision": true,
    "is_live_revision": false,
    "js_tag_id": "4225568320",
    "message": "Auto-generated first draft",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:30:12-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  }
}

Examples

Pause an Invoca Tag

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/pause.json

Format: application/json

Response Code: 200

Response Body:

{
  "id": "4225568320",
  "name": "alpha-test for example.com",
  "description": "This is alpha phase test.",
  "landing_page_url": "",
  "active": false,
  "status": "Paused",
  "created_at": "2023-11-07 03:30:12 -0800",
  "updated_at": "2023-11-07 03:46:45 -0800",
  "live_revision": {
    "author": "Oauth API User",
    "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\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/07/23   3:46 AM');\n  };\n\n  return true;\n})();\n\nvar generatedOptions = {\n  active:              false,\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:46:45-08:00",
    "custom_code": "console.log('Invoca Tag paused at 11/07/23   3:46 AM');",
    "custom_data_fields": [],
    "default_campaign": {},
    "destination_param": null,
    "external_revision_id": 1,
    "is_draft_revision": false,
    "is_live_revision": true,
    "js_tag_id": "4225568320",
    "message": "PAUSED",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:46:45-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision": {
    "author": "Oauth API User",
    "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\", \"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 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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:30:12-08:00",
    "custom_code": "console.log('Invoca Tag paused at 11/06/23   8:26 AM');",
    "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": {},
    "destination_param": null,
    "external_revision_id": null,
    "is_draft_revision": true,
    "is_live_revision": false,
    "js_tag_id": "4225568320",
    "message": "Auto-generated first draft",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:30:12-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  }
}

Examples

Un-pause an Invoca Tag

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/unpause.json

Format: application/json

Response Code: 200

Response Body:

{
  "id": "4225568320",
  "name": "alpha-test for example.com",
  "description": "This is alpha phase test.",
  "landing_page_url": "",
  "active": true,
  "status": "Live",
  "created_at": "2023-11-07 03:30:12 -0800",
  "updated_at": "2023-11-07 03:47:56 -0800",
  "live_revision": {
    "author": "Oauth API User",
    "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\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/07/23   3:46 AM');\n  };\n\n  return true;\n})();\n\nvar generatedOptions = {\n  active:              false,\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:47:56-08:00",
    "custom_code": "console.log('Invoca Tag paused at 11/07/23   3:46 AM');",
    "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": {},
    "destination_param": null,
    "external_revision_id": 3,
    "is_draft_revision": false,
    "is_live_revision": true,
    "js_tag_id": "4225568320",
    "message": "Reverted from Revision 1",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:47:56-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision": {
    "author": "Oauth API User",
    "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\", \"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 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 unpaused 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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:30:12-08:00",
    "custom_code": "console.log('Invoca Tag unpaused at 11/06/23   8:26 AM');",
    "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": {},
    "destination_param": null,
    "external_revision_id": null,
    "is_draft_revision": true,
    "is_live_revision": false,
    "js_tag_id": "4225568320",
    "message": "Auto-generated first draft",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:30:12-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  }
}

Examples

Make an Invoca Tag live

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/go_live.json

Format: application/json

Response Code: 200

Response Body:

{
  "id": "4225568320",
  "name": "alpha-test for example.com",
  "description": "This is alpha phase test.",
  "landing_page_url": "",
  "active": true,
  "status": "Live",
  "created_at": "2023-11-07 03:30:12 -0800",
  "updated_at": "2023-11-07 03:50:00 -0800",
  "live_revision": {
    "author": "Oauth API User",
    "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\", \"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 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    return options;\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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:50:00-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": {},
    "destination_param": null,
    "external_revision_id": 4,
    "is_draft_revision": null,
    "is_live_revision": true,
    "js_tag_id": "4225568320",
    "message": "Auto-generated first draft",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:50:00-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision": null
}

Examples

Revert an Invoca Tag to a previous live revision

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>/revert.json

Format: application/json

Request Body:

{
  "external_revision_id": 2
}

Response Code: 200

Response Body:

{
  "id": "4225568320",
  "name": "alpha-test for example.com",
  "description": "This is alpha phase test.",
  "landing_page_url": "",
  "active": true,
  "status": "Live",
  "created_at": "2023-11-07 03:30:12 -0800",
  "updated_at": "2023-11-07 03:51:22 -0800",
  "live_revision": {
    "author": "Oauth API User",
    "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\", \"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 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 reverted on 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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:50:00-08:00",
    "custom_code": "console.log('Invoca Tag reverted on 11/06/23   8:26 AM');",
    "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": {},
    "destination_param": null,
    "external_revision_id": 4,
    "is_draft_revision": false,
    "is_live_revision": true,
    "js_tag_id": "4225568320",
    "message": "Auto-generated first draft",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:50:00-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  },
  "draft_revision": {
    "author": "Oauth API User",
    "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\", \"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 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/07/23   3:46 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};\n\nInvoca.Client.startFromWizard(generatedOptions);\n\n})(26);\n",
    "cache_lifetime_days": 30,
    "created_at": "2023-11-07T03:51:22-08:00",
    "custom_code": "console.log('Invoca Tag paused at 11/07/23   3:46 AM');",
    "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": {},
    "destination_param": null,
    "external_revision_id": null,
    "is_draft_revision": true,
    "is_live_revision": false,
    "js_tag_id": "4225568320",
    "message": "Reverted from Revision 2",
    "numbers_to_replace": [],
    "numbers_to_not_replace": [],
    "organic_sources": true,
    "re_run_attribution_after": null,
    "required_params": "",
    "reset_cache_on": [
      "gclid",
      "utm_source",
      "utm_medium"
    ],
    "cache_lifetime_warning": null,
    "updated_at": "2023-11-07T03:51:22-08:00",
    "wait_for_in_seconds": 0,
    "cache_lifetime_options": [
      1,
      7,
      14,
      30
    ],
    "warning": null
  }
}

Examples

Delete an Invoca Tag

Endpoint:

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>.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.json

Content Type: application/json

Response Code: 403

Request Body

{
  "name": "test for example.com",
  "description": "An example to show how it works"
}

Response Body

{
  "errors": {
    "name": [
      "has already been taken"
    ]
  }
}

Not Found – 404:

GET

https://invoca.net/api/2022-08-01/networks/<network_id>/js_tags/<js_tag_id>.json

Content Type: application/json

Response Code: 404

Response Body

{
  "errors": {
    "class": "RecordNotFound",
    "invalid_data": "Invoca Tag not found with id: '00548112'"
  }
}