Trying to Place Code

  • Unknown's avatar

    I am trying to add a tracking code to my blog but I do not know where to place it, and when I try to place it as text on a sidebar in a widget while under the hide option. But it shows on the side of my blog and I’m not sure what to do. Thank you.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    What is the exact code? Many codes are stripped out here for security reasons. Paste the code here between backticks so it displays and we can analyze it.

  • Unknown's avatar

    A wordpress hosted site is limited in what code is able to be used, with it only being some HTML. You also cannot alter the underlying code of the site, therefore you cannot add a tracking code to your blog. If you want to add code you will have to self-host using wordpress.org.

    Code – Support
    wordpress.com vs wordpress.org

  • Unknown's avatar

    ‘<script type=”text/javascript”>

    var _gaq = _gaq || [];
    _gaq.push([‘_setAccount’, ‘UA-39641340-1’]);
    _gaq.push([‘_trackPageview’]);

    (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
    })();

    </script>’

    this is the code

  • Unknown's avatar

    Javascript is one of the things we aren’t allowed to post due to the following:

    JavaScript

    Users are not allowed to post JavaScript on WordPress.com blogs. JavaScript can be used for malicious purposes. As an example, JavaScript has taken sites such as MySpace.com and LiveJournal offline in the past. The security of all WordPress.com blogs is a top priority for us, and until we can guarantee scripting languages will not be harmful, they will not be permitted.

    JavaScript from trusted partners, such as YouTube and Google Video, is converted into a WordPress shortcode when a post is saved.

  • Unknown's avatar

    So I can’t post this to my blog?

  • Unknown's avatar

    That’s correct. Some sites offer special versions of code for WordPress.com, or plain HTML. Google Analytics is not one of those sites. You could just do a simple forum search and find a few hundred requests for it, but it does not work here.

  • The topic ‘Trying to Place Code’ is closed to new replies.