Editing
Setting up Event Tracking with our API wrapper
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Step-by-Step Instructions == Setting up Event Tracking involves a sequence of steps to ensure that your API wrapper is correctly configured and working effectively. Below are the detailed instructions: === Step 1: Define Your API Credentials === First, youβll need to establish your API connection by defining your API credentials. Start by including the following lines in your code: ``` define("ACTIVECAMPAIGN_URL", "https://ACCOUNT.api-us1.com"); define("ACTIVECAMPAIGN_API_KEY", "3693354bb1...04c2d126b9c"); require_once("../activecampaign-api-php/includes/ActiveCampaign.class.php"); $ac = new ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY); ``` Replace the placeholder values with your specific ActiveCampaign URL and API key, which can be found in your account settings. === Step 2: Set Up Your Tracking Details === After establishing your API credentials, you need to configure your tracking details. You do this by adding the following code: ``` $ac->track_actid = "764325673"; $ac->track_key = "oy5tbe34c564...69079d18abc"; ``` You can find the '''account ID''' and '''key''' values on the '''Website > Site Tracking''' page of your ActiveCampaign account. Click the link that says '''Event Tracking API'''. === Step 3: Associate an Email Address (if necessary) === If you wish to track an event associated with a specific email address, include it by adding this line: ``` $ac->track_email = "test@test.com"; ``` If you choose not to associate an email address, the event can still be recorded and will be available for creating segments later. === Step 4: Set Your Event Data and Submit the Request === Next, outline the data for your event and submit the tracking request using the following code: ``` $post_data = array( "event" => "event_name1", // e.g., "event_name2" "eventdata" => "event_value", ); $response = $ac->api("tracking/log", $post_data); ``` Your response should resemble the following structure, indicating success: ``` stdClass Object([success] => 1 [message] => Event spawned [http_code] => 200) ``` Once this is complete, the event data will be reflected in your contact's Activity Stream on their Contact Record, enabling the use of this data for segment creation.
Summary:
Please note that all contributions to Activepedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Activepedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information