0

Is there a way to track the clicks of the views isotope header through Google Analytics?

If so how would I set that up? Where would I put the file or code and in what type of file and how would that code be set up?

I'm using: Drupal 7 Views module Views isotope module Google analytics module

1

You can use Google Event Tracking. There is a great module for that already Google Analytics Event Tracking

Just enable both the main and the example module included so you can try it out. In the selectors array you can define wich element you want to track (e.g. a#logo) By setting 'label' => '!test' you can test if the click works (will show an alert box)

$selectors = array(
array(
  'event' => 'mousedown',
  'selector' => 'a#logo',
  'category' => 'Home Link',
  'action' => 'click',
  'label' => 'Logo',
  'value' => 0,
  'noninteraction' => TRUE,
),
  • Brilliant! will try this later tonight. Will i have to duplicate the code above for each item within a menu? or can i use the overall div wrapper as the selector and it will separate which menu link was clicked? I am wondering because more items will be automatically generated at times from autocomplete taxonomy. – Anon Ymous Feb 27 '14 at 1:12
  • You can use a overall class to target the menu links and by setting label => !text you get the name of the menu item (similar to jQuery .text()) – undersound Feb 27 '14 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.