WordPress.org

Ready to get started?Download WordPress

Forums

google analytics - where to put code? (7 posts)

  1. motionid
    Member
    Posted 8 years ago #

    Wanting to use google analytics.
    Wondering where I should put the code so I can see the results.
    Anyone know?
    Cheers,
    Sean.

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    In header template.

  3. chaaban
    Member
    Posted 8 years ago #

    someone just asked this question today ...

    http://wordpress.org/support/topic/49392

    also google tell you where to place it :

    Copy the following code block into every webpage you want to track.
    Click in the box below to select all code. Next, copy it. Then, paste the code segment after the <head>, <meta> tags and before the </head> tag on each page you are planning to track.

    in your themes header.php should be fine ...

  4. NuclearMoose
    Member
    Posted 8 years ago #

    This raises an important point about the structure of WordPress and its theme system.

    If I wanted to use Google Analytics, or any other kind of web service that requires a similar call to a remote script, then I have to duplicate the call in all of the themes I wish to use. Is there a way to set this up so that I can store my links to remote services like this external to the themes? This is too much maintenance to bother with, otherwise.

  5. estjohn
    Member
    Posted 8 years ago #

    could you put the code itself in a .js file or a php file and have it called somwhere in your header? then when called, would run whateve ryou put in the file whether it is that or another?

  6. Joshua Sigar
    Member
    Posted 8 years ago #

    Too much maintenance if you switch theme everyday. In that case, a plugin that utilize the hook wp_head can maintain a single source that could be included in any active theme.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.