html - adding click-to-call to php echo statement -


im sure there simple explanation cant find answer anywhere. function called on header display phone number. im trying add click-to-call tracking when add it, breaks site.

this current code:

function themeblvd_header_contact() {   $link_address = 'tel:3026560214';   echo "<div class='contact-number'>contact @ <a href='$link_address'>(302) 656-0214</a></div>"; } 

when add click-to-call when breaks:

$link_address = 'tel:3026560214';  echo "<div class='contact-number'>contact @ <a onclick="ga('send', 'event', 'phone number', 'click call', '3026560214', 1);" href='$link_address'>(302) 656-0214</a></div>"; 

i see closing string in middle of , making new one, 2 quotes problem here. try escape string this.

$link_address = 'tel:3026560214';  echo "<div class='contact-number'>contact @ <a onclick=\"ga('send', 'event', 'phone number', 'click call', '3026560214', 1);\" href='$link_address'>(302) 656-0214</a></div>"; 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -