Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/contacts/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ public function listAutomations(int $id)
return $req->getBody()->getContents();
}

public function triggerAutomation(int $contact_id, int $automation_id) {
$req = $this->client
->getClient()
->post('/api/3/contactAutomations', [
'json' => [
'contactAutomation' => [
'contact' => $contact_id,
'automation' => $automation_id
]
]
]);

return $req->getBody()->getContents();
}

/**
* Add a tag to contact
* @see https://developers.activecampaign.com/reference#create-contact-tag
Expand Down
102 changes: 102 additions & 0 deletions src/tracking/SiteTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,52 @@
class SiteTracking extends Resource
{

/**
* Add a domain to the site tracking whitelist
* @see https://developers.activecampaign.com/reference#add-domain-to-whitelist
*
* @param string $domain_name
* @return string
*/
public function addDomain($domain_name)
{
$req = $this->client
->getClient()
->post('api/3/siteTrackingDomains', [
'json' => [
'siteTrackingDomain' => [
'name' => $domain_name
]
]
]);

return $req->getBody()->getContents();
}


/**
* Get site tracking code (javascript snippet)
* @see https://developers.activecampaign.com/reference#retrieve-site-tracking-code
*
* @param array $query_params
* @return string
*/
public function retrieveSiteTrackingCode(array $query_params = [])
{
$req = $this->client
->getClient()
->get('api/3/siteTracking/code', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}


/**
* Get site tracking status (enabled or disabled)
* @see https://developers.activecampaign.com/reference#retrieve-site-tracking-status
*
* @param array $query_params
* @return string
*/
Expand All @@ -29,4 +72,63 @@ public function retrieveStatus(array $query_params = [])
return $req->getBody()->getContents();
}


/**
* Enable or disable site tracking
* @see https://developers.activecampaign.com/reference#enable-disable-site-tracking
*
* @param boolean $enabled
* @return string
*/
public function setTrackingStatus($enabled = true)
{
$req = $this->client
->getClient()
->put('api/3/siteTracking', [
'json' => [
'siteTracking' => [
'enabled' => $enabled === true ? true : false
]
]
]);

return $req->getBody()->getContents();
}


/**
* Remove a domain from the site tracking whitelist
* @see https://developers.activecampaign.com/reference#remove-domain-from-whitelist
*
* @param string $domain_name
* @return string
*/
public function removeDomain($domain_name)
{
$req = $this->client
->getClient()
->delete('api/3/siteTrackingDomains/' . $domain_name);

return 200 === $req->getStatusCode();
}


/**
* List of all whitelisted site tracking domains
* @see https://developers.activecampaign.com/reference#list-all-whitelisted-domains
*
* @param array $query_params
* @return string
*/
public function listAllDomains(array $query_params = [])
{
$req = $this->client
->getClient()
->get('api/3/siteTrackingDomains', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}

}