I have a website and separate Wordpress site as well. The wordpress site is setup at mydomain.com/blog/.

Currently I have google analytics tracking the main website but data is missing for the WP website. Do I need a separate tracking code? Can I use the same tracking code as my main website. Will there be any interference if I put the same tracking code into Yoast on my Wordpress as the main website?


You have two options.

Option 1: use the same tracking code for your main website and your WordPress site. This is probably the easiest solution, and it will give you access to the same goals, user data, etc. all in one convenient location.

Option 2: use a different tracking code, so you can more easily track the two separate websites. The biggest downside is that if you want to be able to see users' journeys across both sites, there's a lot more setup involved; when you use two separate tracking codes, by default someone going from one site to the next will appear to be "leaving your website," which depending on how your site is set up, may or may not be how the user experience feels.

So, if they are truly very independent sites where visitors don't overlap much, you can use separate code, but otherwise you probably will want to just use the same code. (You have to install the tracking code on every platform you're tracking - it's not automatically flowing from WordPress because you haven't told WordPress to include that tracking code.)

| improve this answer | |
  • I prefer option 1 but was worried that the same tracking code in both sites may cause a conflict. It won't? – markhorrocks Mar 28 '19 at 18:16
  • 1
    No. Since WordPress is controlling everything that shows up in your /blog/ directory, the tracking code you have running outside the /blog/ directory won't affect it. Just think of it like this: you have to install tracking code everywhere where you want to track visitors. In your main site you put it in the HTML or whatever CMS you're using. In other sites you do the same - you put the tracking code on that portion of the site. All you're doing is adding the same JavaScript to every page of your site - regardless of what system each page is running. – WebElaine Mar 28 '19 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.