Skip to main content

SurveyCompo GTM Event Listener

Track SurveyCompo survey widget interactions in GTM. Monitor survey start, question changes, and submission with survey_action_type variable.

surveycomposurveyfeedbackgtmga4voice-of-customer

Event fired

survey_compo_interaction

Key variable

survey_action_type

SurveyCompo

Overview

SurveyCompo is a survey builder for websites and apps. This listener tracks survey interactions using SurveyCompo's JavaScript event API.

Event fired: survey_compo_interaction Variable: survey_action_type

Tracked Events

survey_action_typeDescription
survey startedSurvey begins
page changedUser navigates survey pages
survey submittedSurvey completed
survey abandonedUser exits mid-survey

Installation

html
<!-- GTM Custom HTML Tag: SurveyCompo Listener -->
<script>
(function() {
  function scPush(action, extra) {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push(Object.assign({
      'event': 'survey_compo_interaction',
      'survey_action_type': action
    }, extra || {}));
  }

  document.addEventListener('surveycompo:start', function(e) {
    scPush('survey started', { surveyId: e.detail && e.detail.surveyId });
  });
  document.addEventListener('surveycompo:page-change', function(e) {
    scPush('page changed', {
      surveyId: e.detail && e.detail.surveyId,
      currentPage: e.detail && e.detail.currentPage,
      totalPages: e.detail && e.detail.totalPages
    });
  });
  document.addEventListener('surveycompo:submit', function(e) {
    scPush('survey submitted', { surveyId: e.detail && e.detail.surveyId });
  });
  document.addEventListener('surveycompo:abandoned', function(e) {
    scPush('survey abandoned', { surveyId: e.detail && e.detail.surveyId });
  });
})();
</script>

Data Layer Output

json
{
  "event": "survey_compo_interaction",
  "survey_action_type": "survey submitted",
  "surveyId": "survey_abc123"
}

Trigger Configuration

Trigger: Custom Event | survey_compo_interaction

Related Listeners