Support » Fixing WordPress » Google Anlytics; hardcoding or using a plugin?

  • Hello Community,

    I’m new to WP and still exploring and learning many of its aspect.

    I run a (very) small blog that I want to monitor using GA (unless there is another recommendation). I pretty much know how to connect the blog to GA, but I have one question that I hoped that you could help me with: should I hardcode the GA ID into the theme or should I use a plugin?

    Basically, whenever it makes sense I usually prefer to hardcode or edit the WP/Theme files over using plugins to achieve the required functionality. I learn a lot from it, and although I might be wrong, I assume that it reduces the security risk and the overall dependability on the plugin’s continued maintenance.
    When it comes to GA I’m not so sure how to go about it. I assume that a plugin adds the GA ID even when switching themes (I’m still experimenting with the look and feel so I’m going back between themes now and again), while in the manual approach I would need to remember to add it with each theme change.
    I would appreciate any recommendation.

    Also, in case I will hard code it, where should I insert the code into? The header.php or the footer.php (I read mixed opinions)?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • in my opinion, less plugins = less headache. put it in header.php – just before wp_head() gets called.

    J M


    Some web hosting companies offer Analytics at domain level, so it’s worth checking with your host in regards to that option.

    Thank you.

    I will check with my host, thank you for pointing this out.

    I tend to agree with your approach :). Thank you for indicating where the code should go.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Google Anlytics; hardcoding or using a plugin?’ is closed to new replies.