I want to do something special I think. I need to add a html-snippet with GA-Code to a function in functions.php. To do this I thought to add this piece of code:
echo ('<div onClick="ga('send', 'event', 'will-ich-haben', 'klick', 'test-klick');">');
to this function:
// Will ich haben
add_action( 'woocommerce_product_meta_end', 'childReview' );
function childReview() {
global $post;
echo do_shortcode('[cl-popup size="l" btn_label="Will ich haben!" btn_bgcolor="#006982" btn_color="#ffffff" overlay_bgcolor="rgba(0,105,130,0.75)" title_textcolor="#006982" content_textcolor="#006982"]
<p align="center" style="color: #999999;"><i>' .get_the_title( $post_id ). '</i></p>
<img style="width: 400px; height: auto; float: left;" src="' .wp_get_attachment_url ( get_post_thumbnail_id( $post->ID ) ). '"/>
<h2>So kommst du zum Produkt:</h2>
<ul style="margin-left: 50px;">
<li><a href="http://www.wohngeschwister.de/kontakt/">Besuch uns am Grossneumarkt!</a></li>
<li>Schreib uns eine E-Mail: <a href="mailto:[email protected]?subject=Interesse%20an%20' .get_the_title( $post_id ). '">[email protected]</a></li>
<li>oder ruf uns an: <a href="tel:04046643937">040/466 439 37</a></li>
</ul>
Übrigens: Egal für welchen Weg du dich entscheidest, in Zusammenarbeit mit <a href="http://delivva.de/" target="_blank">delivaa </a>liefern wir dir dein Lieblingsprodukt innerhalb von 60 Minuten innerhalb Hamburgs!
[/cl-popup]');
}
I tried to simply add it but that occured an error. Do you know how to integrate it a smart way? Goal: Measure clicks on the button which is generated through the shortcode.
Huge thanks in advance, Dario