Skip to content

Instantly share code, notes, and snippets.

@mauriciodarocha
Last active December 15, 2015 20:49
Show Gist options
  • Save mauriciodarocha/5321317 to your computer and use it in GitHub Desktop.
Save mauriciodarocha/5321317 to your computer and use it in GitHub Desktop.
Google Conversion Tag Image. Insere imagem para google ad services.
<script type="text/javascript">
$(document).ready(function (param) {
place_google_conversion_img_tag();
});
var place_google_conversion_img_tag = function () {
// não passa deste ponto se não for a página "finaliza-compra"
if(!$('body').hasClass("finaliza-compra")) return false;
// não passa deste ponto se já foi inserida a tag.
if($(".gctag").length>0) return false;
var orderid = $('#orderid').text();
var totalAmount = $('#totalAmount').text().replace(".","").replace(",",".");
var img_url = "//www.googleadservices.com/pagead/conversion/986378069/?value="+totalAmount+"&amp;label=NiowCPPttgQQ1d6r1gM&amp;guid=ON&amp;script=0";
var img = '<img class="gctag" height="1" width="1" style="border-style:none;" alt="" src="'+img_url+'"/>';
$("body").append(img);
return true;
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment