It's now possible to see your survey activity in Adobe Analytics. Below, you'll find step-by-step instructions on how to implement it.
Please note that using JavaScript API, needed for this process to work, is available on some of our plans.
1. First, implement Adobe Analytics using the Analytics extension. Please follow the steps in this link.
2. Create a Data Layer:
a. Initialize the Data Layer by declaring:
window.adobeDataLayer = window.adobeDataLayer || [];
.
b. To process the entries added to the adobeDataLayer
array, you must load the
Adobe Client Data Layer script:
i. Use the following tag to load the script:
<script src="adobe-client-data-layer.min.js" defer async></script>
.
ii. Once the Data Layer script is loaded, it processes each entry in the order
they were added to the array. After this point, the array queue continues to
interact with the Data Layer. Any new entries added to it will be processed by
the Data Layer without delay.
c. Use window.adobeDataLayer.push()
to add your event to the Adobe Data Layer.
i. The Data Layer array serves as a first-in-first-out queue that avoids race
conditions between scripts and maintains a complete history of events.
d. Add event data from surveys, for example, when a question is answered:
window.addEventListener('SurvicateReady', () => {
window._sva.addEventListener('question_answered', (surveyId, questionId, answer) => {
// Create an object with the event information
const survicateEvent = {
answer,
eventType: 'QuestionAnswered',
provider: 'Survicate',
questionId,
surveyId,
};
// Push the object to the Adobe Data Layer
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push(survicateEvent);
});
});
Other JavaScript events, besides question_answered, can be found here.