Quick Start
Get Started
Tracking and Consent Functions
Tracking and Consent Use Cases
Get Started as an Account Engagement ISV
Extend the Email Builder Experience
The Tracking and Consent API supports these functions.
create (<integer> piAId, <integer> piCId, <string> tracker domain hostname)
Creates the Account Engagement tracker necessary for analytics. Add 1000 to the Account Engagement instance ID (piAId) and the campaign ID (piCId).
Example
1pdt(‘create', 0001, 0002, ‘go.example.com’);set(<string> propertyName, value)
Return: undefined
Updates the value of a tracked property. Subsequent page views sent to Account Engagement include the updated property value. See Writeable Analytics Parameters for the properties that support updates.
Example
1pdt("set", "title", "About Us");sendPageView()
Return: undefined
Sends a page view to Account Engagement that includes the current values of Tracker object properties. If the value of the pi_opt_in cookie is false, then no request is made.
Example
1pdt("sendPageView");showConsentBanner()
Shows the Account Engagement consent banner, allowing the visitor to choose to give consent to Account Engagement analytics tracking.
Example
1pdt("showConsentBanner");hideConsentBanner(<null|boolean > status)
Hide the Account Engagement consent banner from the page. If true or false is given, the pi_opt_in status is updated. If null is given, the banner is hidden and the status isn’t updated.
Example
1// hide the consent banner
2pdt("hideConsentBanner", null);
3// hide the banner and set opt in status to false
4pdt("hideConsentBanner", false);
5// hide the banner and set opt in status to true
6pdt("hideConsentBanner", true);setOptIn(<boolean> status)
Set the value of the pi_opt_in cookie. Account Engagement analytics only records page views when the value of this cookie is true.
Example
1pdt("setOptIn", true);revokeConsent()
Return: undefined
Deletes any existing visitor tracking cookies and sets the pi_opt_in cookie value to false.
If the pi_opt_in cookie is true or unset a page view request is sent to Account Engagement. If your Account Engagement settings require the visitor to give consent based on their geo, then no page view is recorded and the Account Engagement consent banner is displayed.
Example
1pdt("revokeConsent");clearTrackingCookies()
Deletes all Account Engagement tracking cookies.
Example
1pdt("clearTrackingCookies");Adding analytics actions to the queue is the primary way to interact with Account Engagement analytics. To retrieve data from the Account Engagement analytics tracker, pass a callback function into the queue. The callback function is executed when the queue is processed and it is passed a reference to the Account Engagement tracker.
Since analytics is processed asynchronously, interacting with tracked values must be done within a callback function that is processed after the analytics library has loaded. In this example the current consent status is fetched, which then can be used to gate logic on your web page.
1pdt(function (tracker) {
2 let consentStatus = tracker.getConsentStatus();
3 if (consentStatus === false) {
4 // take custom site action
5 }
6});get(<string> propertyName)
Return: mixed
Returns the value of a tracked property.
Example
1pdt(function (tracker) {
2 let url = tracker.get("url");
3});getConsentStatus()
Return: null|boolean
Returns the current consent status for the Account Engagement tracker. If no consent status has been set, null is returned.
Example
1pdt(function (tracker) {
2 let status = tracker.getConsentStatus();
3});The following parameters can be updated using the set function.
| Name | Type | Description |
|---|---|---|
url | String | The url of the tracked page. default: document.URL. |
title | String | The title of the tracked page. default: document.title. |
referrer | String | The referring location to the tracked page. default: document.referrer or query string param ‘referrer’ if it exists. |
piEmail | String | Manually link a visitor to a prospect by email address. Must be a valid email address. |
piPoints | Integer | Manually override score for page view. |
piProfileId | Integer | Manually set the profile for visitors. |
utmCampaign | String | Google Analytics parameter. Can be used to set Account Engagement campaign. |
utmMedium | String | Google analytics parameter. Distinguishes Bing/Yahoo natural vs. paid search. |
utmSource | String | Google analytics parameter. Can be used to set the prospect’s source field. |
utmTerm | String | Google analytics parameter. Used with an ad id in the Google Ad Keyword report. |