vendredi 6 novembre 2015

How to add Google events tracking code to CTA button on popup?

I have installed a pop-up plugin on my Wordpress site. The pop-up has a CTA button that links to an inner page and I would like to track clicks on the button using Google events tracking.

This is the Google analytics code I'm using: onClick="_gaq.push(['_trackEvent', 'Popup', 'click']);"

and the following code is from the plugin which outputs the CTA button link:

if ( $has_cta ) {
        $cta_button_tag = sprintf(
            '<a href="%1$s" class="wdpu-cta" target="%2$s">%3$s</a>',
            esc_url( $this->cta_link ),
            esc_attr( $cta_target ),
            esc_html( $this->cta_label )
        );



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire