Tagged: button, google analytics
When viewing In-Page Analytics, Google isn’t reporting clicks on a button. The button is within a Promo Box.
Is there a workaround for this?
Hi ihf-eramstad!
Thank you for using Enfold.
You need to add the _trackEvent() method on the button. Edit config-templatebuilder > avia-shortcodes > button.php. Find this coed on line 226:
$output .= "<a href='{$link}' class='avia-button ".$this->class_by_arguments('icon_select, color, size, position' , $atts, true)."' {$blank} {$style} >";
Add the onclick attribute provided by GA. Refer to this link: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#SettingUpEventTracking
You should replace the code above with something like this:
$output .= "<a href='{$link}' onClick='_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);' class='avia-button ".$this->class_by_arguments('icon_select, color, size, position' , $atts, true)."' {$blank} {$style} >";
Best regards,
Ismael