Although Personalization can capture visitors’ webpage views on their own, there are also other methods which can capture data. Each of the following methods can make use of additional variables to capture more specific information:
JavaScript variables
You can also define variables directly in your page’s JavaScript, like the following:
window.AcquiaLift.profile.person_udf5 = 'my dynamic content goes here';
The default timeout set in both lift.js
and the /decide-js
endpoint is 30 seconds. You can alter the timeout value for all calls (except authentication calls) by providing a different timeout value. For example, the following code increases the timeout value to 60 seconds:
window.AcquiaLift.loadTimeout = 60;
Tracking scripts
You can perform various actions using tracking scripts to capture more information about your Page Views.
Capturing a page view
To capture a page view, add the following JavaScript code to your webpage:
<script type="text/javascript">
_tcaq.push(['capture', 'Content View']);
</script>
Personalization captures the page view and associates it with the website visitor’s information.
Note
You will generally want to capture the page view for every tracked webpage, you can add the instruction to the end of the Personalization tracker script.
Capturing additional page view information
The capture method includes several parameters which you can use to include additional information about the webpage or the website visitor:
_tcaq.push(['capture', '<category>', {'<parameter>':'<value>'}]);
Capturing do_not_track information
Personalization provides the ability to set do_not_track information for a user. The capture API (POST call) allows the user to send a capture while indicating whether or not the visitor should be tracked. The capture must use the following event_name: updatePersonTracking
. For example:
{
"identity": "qa_5373_2016-12-01 13:21:[email protected]",
"identity_source": "email",
"do_not_track": true,
"return_segments": true,
"captures": [
{
"event_source": "app",
"event_name": "updatePersonTracking",
"event_date": "2016-11-24 13:21:57.418",
"engagement_score": 0
}
]
}
Passing custom events through the JavaScript API
To use custom events with Personalization, create an event in Personalization.
You can then pass the event to the Personalization service by using the following JavaScript command:
<script type="text/javascript">
_tcaq.push(['capture', 'event_id']);
</script>
where event_id
is the ID of the event you created.
Note
Public _tcaq
functions are only available after lift-capture.js
is loaded on a page after personalization return. You will know lift-capture.js
hasn’t loaded on a page if you receive the following reference error:
ReferenceError: _tcaq is not defined
Drupal taxonomy mappings
You can use Drupal taxonomy terms in your page capture by ensuring you have mapping fields set to taxonomy vocabularies in your Personalization-enabled Drupal website. These can be set in the Personalization settings by going to Configuration > Web Services > Personalization, in the Data collection settings section.