php - Embedding Google Conversion Code in Alert -
php - Embedding Google Conversion Code in Alert -
i'm using avada's template (http://theme-fusion.com/avada/contact/) , working contact page. whenever submit's successful form, page beingness reloaded additional "alert" box that's populated success message. i'm looking embed google conversion pixel in alert box if possible instead of having send user whole new page. code creates alert box
<?php if(isset($emailsent) && $emailsent == true) { //if email sent ?> <?php echo do_shortcode( '[alert type="success" accent_color="" background_color="" border_size="1px" icon="" box_shadow="yes" animation_type="0" animation_direction="down" animation_speed="0.1" class="" id=""]' . __( 'thank you', 'avada' ) . ' <strong>' . $name . '</strong> ' . __( 'for contacting us! email sent!', 'avada' ) . '[/alert]' ); ?> <br /> <?php } ?>
which generates
<div class="fusion-alert alert success alert-dismissable alert-success alert-shadow"> <button type="button" class="close toggle-alert" data-dismiss="alert" aria-hidden="true">×</button> <span class="alert-icon"> <i class="fa fa-lg fa-check-circle"></i> </span> give thanks <strong>test</strong> contacting us! email sent!</div> <br /> </div>
code looking embed looks this
<script type="text/javascript"> /* <![cdata[ */ var google_conversion_id = 1; var google_conversion_language = "en"; var google_conversion_format = "2"; var google_conversion_color = "ffffff"; var google_conversion_label = "1"; var google_remarketing_only = false; /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1/?label=1&guid=on&script=0"/> </div> </noscript>
any help appreciated
since each line has opening , closing php tags can paste html code between 2 php blocks (but after "if" block). might take utilize image tag noscript block (conversions still tracked).
<?php if(isset($emailsent) && $emailsent == true) { //if email sent ?> // noscript image tag, alternatively paste whole code here <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1/?label=1&guid=on&script=0"/> <?php echo do_shortcode( '[alert type="success" accent_color="" background_color="" border_size="1px" icon="" box_shadow="yes" animation_type="0" animation_direction="down" animation_speed="0.1" class="" id=""]' . __( 'thank you', 'avada' ) . ' <strong>' . $name . '</strong> ' . __( 'for contacting us! email sent!', 'avada' ) . '[/alert]' ); ?> <br /> <?php } ?>
php wordpress google-analytics pixel
Comments
Post a Comment