Using Google AdWords Conversion Tracking in Meteor

1.1k views Asked by At

I want to embed the Google Adwords Conversion Tracking Code into my Meteor app:

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXX;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "XXXX";
var google_remarketing_only = false;
/* <![CDATA[ */
</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/XXXX/?label=XXXX&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

I tried to put it right into the html code of a template and I tried to append it to the html after the template rendered:

Template.success_page.rendered = function () {
    $("body").append(
        '.....');
}

Both ways do not work. The Tag Assistant Chrome Plugin gives me the error "No HTTP response detected". And on the browser console I can see

"Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened."

How do I have to embed it to make it work?

1

There are 1 answers

2
Gerwin Brunner On BEST ANSWER

I just integrated it using this:
https://developers.google.com/adwords-remarketing-tag/asynchronous/

It is coming from a remarketing perspective, but the conversion tag and the remarketing tag are basically the same thing. Just set "google_remarketing_only" to false