Twitter Tracking Code breaking page functionality


Hi I have received the follwoing tracking code from twitter but when i place it in the body of my site it completely screws up the functioanlity of other features on the page.

Ive tried to use online javascript validators to spot if there is an error but so far im having no luck. Could anyone assist please?



Are you placing JavaScript on your page generated by for tailored audiences or conversion tracking?


Hi niall,

Thanks for response. I think i may of got to the bottom of the issue.

I was calling wigets.js on the same page for twitter embeds and because the tracking script was also on the same page it was conflicting (i think) I found this script here which allows the twitter object to work asynchronously

<script>window.twttr = (function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0],    t = window.twttr || {};  if (d.getElementById(id)) return t;  js = d.createElement(s); = id;  js.src = "";  fjs.parentNode.insertBefore(js, fjs);   t._e = [];  t.ready = function(f) {    t._e.push(f);  };   return t;}(document, "script", "twitter-wjs"));</script>

my previous script was as follows

    window.twttr = (function (d, s, id) {
        var t, js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); = id;
        js.src= "";
        fjs.parentNode.insertBefore(js, fjs);
        return window.twttr || (t = { _e: [], ready: function (f) { t._e.push(f) } });
    }(document, "script", "twitter-wjs"));</script>*@

Im not sure if my thinking is correct but it seems to have solved it