In this session we show how to add Google Analytics tracking code to Thesis in Thesis Site Options. No plugin is necessary. There is only one instance in which it is necessary to use a plugin in Thesis to use Google Analytics and that is when you are using WP eStore and you want to track your ecommerce transactions. In that case, you would use the Google Analytics for WordPress Yoast plugin.
Member: What crossed my mind is that when you said with Google Analytics, they’ve got like a little code, that UA with a 6 or 7 or 8 different numbers?
Rick: Oh sure, absolutely, yeah.
Member: But then they also… and you were talking about actually applying the code to this site. So my question was when do you use one or the other? Does one require a plugin? So anyway, go for it.
Rick: Well, in standard WordPress Thesis installation, you do not need a plugin. You can simply use your code. So for example… and I’ll show you what I mean by that. There’s only one instance in which you need to use a plugin when you’re working with Thesis. Otherwise, Thesis has this system that’s built in to it to add your Google Analytics tracking code.
And the most efficient, fastest, least resource intense way to deal with it is to simply use the Thesis system which is under Thesis Site Options. And you’ll get it in your Google Analytics tracking code from Google themselves in your Analytic setup. So what you do then is you come over here to additional scripts and you place that Analytic tracking code right here in the additional scripts. Now you can see that we’ve got this little thing in here called stat and software tracking scripts. And they say that you should put your Google Analytics here but actually, with… what on earth is going on there? Holy smokes, I’ve got Google Analytics set up in both places, don’t I? Okay, well that’s a silly mistake. I have it… I have Google Anatlytics set up to be installed in 2 places which is a silly thing to do. Save it so that it only goes here.
And the thing is that the Google Analytics tracking script is what’s called… it’s known as asynchronous which means that it does not require… it doesn’t have to finish loading before your web browser can move on. Now you know, when Thesis was orginally created, they had this little system here where you know… well, when Thesis was originally created, Google tracking script was not asynchronous. And so what would happen is that your page would not continue loading until after Google had loaded its stuff, if you put it in the head, which is why they recommend that you put it… you not put it in the head. But since Thesis was designed, Google Analytics has gotten smarter and now their tracking script is asychronous and it should be placed in this section called additional scripts. It should not be placed where Thesis tells you to place it which is under stats and tracking scripts.
So that’s the first thing to say is that your normal everyday WordPress site is going to have its Google Analytics tracking code set up additional scripts.
Member: And you can put that anywhere inside of additional scripts. If you’ve got a script in there or something else, you could put it either above it or below it…
Rick: Yes, in fact, you can see I do have 2 scripts. I have my Webmaster Tools site verification script and then I have my Google Analytics tracking script. I’ve got them both. And so any… yes so that as long as that you know, as long as the script tag itself opens and closes then you can put anything here that you want or that you need to show up in the head. You could even put in a line of CSS in here. You could put a style in here that would go in the head too. Because essentially, what happens here is that Thesis takes whateevr is in this box and puts it in the head tag of your… of the HTML page.
So there’s the one exception to this in Thesis and that is when you are using WP eStore and you want to track your ecommerce transactions. And if you want to track your ecommerce transactions in Google Analytics then you can’t use the Thesis for adding your tracking script. You have to use instead the Yost plugin for that.
And so that’s what I have on BYOB Website. In BYOB Website, I have the WordPress SEO by Yost… not WordPress SEO, not SEO, sorry. I have WordPress Analytics. Where is that? Oh, it’s Google Analytics for WordPress. So we have Google Analytics for WordPress and because it interfaces or because WP eStore can interface with it and provide the ecommerc etracking that’s needed on the transction result page.
In this case, you’re not using your whole code. In this case, you’re only using your little bit, your little piece of UA code so this is where you’d use that little 10-character thing or however many characters it is.
Member: So if you have a… an ecommerce WordPress then you want to use that little code there because that’s… that little thing you’re looking at right now.
Rick: Well, it’s not a good summary of what I said. What I said is if you are using WP eStore, not just any… not any plugin but WP eStore and if you want to track your transactions in Google Analytics then you need to use a plugin which… and there’s only one plugin that works for this and that’s the Google Analytics for WordPress by Yost. And in his plugin, all you need to do is put the code and you don’t need to put the rest of the code because it takes care of all the rest of the code. You just have to put your UA number in. But this is only the case when you are using WP eStore. It doesn’t work in Shopp, for example. It’s only the case if you’re using WP eStore and you are also trying to use ecommerce tracking with Google Analytics. So it’s a narrow situation in which you would do this.
Member: If I’m using that code that you have in front of us right now in a WordPress that doesn’t have ecommerce, does that hurt it or help it or does tha make any difference?
Rick: It just slows your site down a little bit, some small amount because it requires an extra set of processing that’s already being handled by Thesis. So Thesis is doing one set of processing whether you like it or not. Whether you’re using it or not, Thesis is doing some processing. And now what you’re doing then is you’re adding this Google Analytics plugin which is going to repeat some of that processing.
Member: So if I was to… this is so cool. If I was doing it properly when I would want to use that code, assuming that I made a WP eStore, I would want to use that code instead of this little short thing here in my website.
Rick: Yeah because what you have is… what you referred to as your really long code is the full tracking script. You would use the full tracking script with Thesis unless you meet this one narrow set of conditions.
Rick: This little UA code is a very small part of that big tracking script. If you’re using… if you’re in this one very narrow situation then you would use your UA code and not your tracking script. Only in that condition.