Drupal analytics survey?

I am trying to track how often the type of survey content is answered as a block in Drupal when it is embedded on several pages as a block. For example, if 5 users respond to a survey on page A and six users answer on page B, I need to know these glitches, but not their specific answers.

I planned to just look in Google Analytics the number of times that users chose the path from the page Page A → Poll, but the response to the survey actually leaves the user on the same page, so I don’t understand how to do this. Any suggestions?

+3
source share
1 answer

Google Analytics - . JavaScript GA, , .

Drupal. URL-, . hook_form_alter

JavaScript , jQuery, - .

$("#poll-form #edit-submit").click(function(){
  if ($(this).hasClass('ready')) {
    return true;
  }
  // Do your thing with GA, add a callback function when you have posted to google:
  function callback() {
    $("#poll-form #edit-submit").addClass('ready').click();
  }

});

GA api , , , .

+3

Source: https://habr.com/ru/post/1761911/


All Articles