Example Usage of
 track_site_whitelist_add

Add site tracking whitelisted domains

Description: Add domains to the site tracking whitelist (that are allowed to be used for site tracking). Make sure to enable site tracking before making this call (domains added with site tracking disabled will not be saved).
Endpoint: https://{ACCOUNT}.api-us1.com/api/2/track/site
HTTP method: PUT
Supported output formats: json
Requires authentication: Yes
Parameters:
* indicates requirement. Underlined params include in URL, otherwise as part of the post body. POST data must be formatted as
Content-Type: application/x-www-form-urlencoded
. We don't accept any other input formats like JSON.
Variable Description
api_key*Your API key
domain*The domain you want to whitelist. Example: 'www.test.com'
Example response:
Variable Description
domainThe domain that you added to the whitelist. Example: 'www.test.com'
successWhether or not the request was successful. Example: 1 (successful) or 0 (not successful)
messageThe response message. Example: "Domain added"

PHP Example

This is an example of using the track_site_whitelist_add call with PHP. You can replicate the same idea in virtually any other programming language. This example requires our PHP API wrapper. Make sure to update the path to the wrapper files in the example code below (if it is not the same).

 <?php

// Set up an object instance using our PHP API wrapper.
define("ACTIVECAMPAIGN_URL", "https://{ACCOUNT}.api-us1.com");
define("ACTIVECAMPAIGN_API_KEY", "{API_KEY}");
require_once("../activecampaign-api-php/includes/ActiveCampaign.class.php");
$ac = new ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY);
$ac->version(2);

$put_data = array("domain" => "www.test.com");
$response = $ac->api("tracking/whitelist", $put_data);

echo "<pre>";
print_r($response);
echo "</pre>";

?>

Questions? Discuss this API call in our developer forum

You can install activecampaign-api-php by downloading (.zip) or cloning the source:

git clone git@github.com:ActiveCampaign/activecampaign-api-php.git