Skip to content

Setting up Google analytics on your WordPress affiliate marketing website

  • by

add google analytics to your site to help your business grow

All these people visiting your site…you think that they are…

But how do you know…

Install google analytics tracking code and see what people do on your site….

Installing Google analytics is an important step at the beginning of setting up an affiliate marketing website due to the fact that you want your time input to be rewarded. If you can determine where your traffic are going and what they are doing, you can adjust your time effort to give the most return on investment.

When you are working blind you continue to create content without knowing whether it is being read or you are going in the right direction.

It is important when starting an online business to know who your visitors are and what they are doing  on your site.

So let’s find out what google analytics is and how to install it, so you can get back to the important process of creating content for your visitors…

Why bother with google analytics

If you were a shopkeeper then you can see who is coming in and what they are browsing…maybe not everyone…but a fair few of them…why should you bother adding analytics - so you can measure the performance of your business.

But what if you could replay each shopper coming in and see what department they visited and where they stopped for a while…

What age they were…where they come from….how did they find you….

Wow with so much information on each visitor you would be able to tailor things for the majority – readjust your store so maybe they have to pass through another section you hope to promote before getting where they want.

What if there was a way to do this with your wordpress website…..

And for free… ( so you think…)

So to find out this information, one of the best ways to do this is to join forces with one of the largest search engine businesses in the world.

Install google analytics onto your site and you get access to all the information that google is prepared to give away.

In return you are another little box for google to gather the data and combine it with all the rest – to improve it’s service and results returned to your visitors…

Adding the google code

To gather the data about your visitors Google needs to be able to see that you are participating in it’s data collection scheme.

So you need to add something to your site to indicate this to google.

Google has setup a couple of programs to allow you to do this easily.

You will need to have a google account.

And signup for google analytics account at ( google accounts website)

It is easy and doesn’t cost to join.

And once inside you enter the details of your site – you can have multiple sites under one account.

– make sure you change the http to https if you have a ssl certificate on your site – google sees this as another property…

When you have set this up you are presented with a tracking code and various ways to add the data to your site.

Some say just add the number ( a unique UA-xxxxxxx-y number is issued for each site – the xxxx number will stay the same but the number will increment for each additional site added to your account) others say add the whole tag…

Well it depends on how you add the code as to what you can add…

And whether you want to go onto add advanced analytics in the future for conversion tracking or events tracking…

If you answered yes then add the tag…

If you want the basic web analytics then you can just add the tracking number to your blog…

Via the head section of your site

If you go into your wordpress dashboard and click on appearance then you can go to theme editor…add via coding- but don't add to your theme directly always use a child theme to prevent loss

Just make sure that when you are adding the code this way you don’t lose it when the theme is updated.

You will need to add the code into the head section of a child theme – if you don’t know how to create one of these or don’t want to create one then maybe choose another method of verification.

Select the theme header file.

From your google analytics page copy the whole part of the gtag

Locate the <head> tag and create a newline after this

Paste the code in there and click update the file.

This has now added the code to the head section of your site and will be available on each page of your site.

To verify this select a page to visit and then right click and select view source.

In the new tab press CTRL+f and a box will open for searching.

Type in UA- and press return.

You should now be taken to the area where the tag has been inserted.

Via a plugin

If you don’t want to add the analytics code via a child theme then the next best way is to add it via a plugin

There are many that can accomplish this in various guises.add via a plugin - this way you don't lose the code if you change your theme or you update your theme

Your seo plugin may have a section for analytics where you add the UA-xxx number – or if you are lucky the whole tag code ( if you do find one of these let me know which one it is), but mostly they only allow the UA code.

Others like insert headers and footers or ad inserter can add the complete tag and not lose the code at theme update time.

I am aware that adding plugins can increase your sitespeed – so keeping them down to a minimum and well coded ones is a benefit.

Of the two above ( insert headers and footers and ad inserter) i prefer to go with ad inserter -the main reason is that it combine a few features in one plugin.

Insert headers and footers – does what it says on the tin – add code to the head section and footer section ( along with the body section) – but that’s it…

Ad inserter on the other hand you can add code to the head section, footer section, add hooks, setup what to display if you detect ad blocking.

Along with adding the ads.txt file if you decide to add adsense to your site…

And control the ad blocks, where to place them on the page and which pages display the ads…

You can also add site wide scripts – so anything you need to add site wide can be added as a block.

If you need to change this then it is changed in one place and the changes are applied sitewide.

But back to the adding of the tag from google…

First you need to add the plugin.

Navigate to plugins

Then add new ( right at the top )

Search for ad inserter in the search box and click on install when it shows up.

Once installed then click on activate

Getting to the settings of the plugin you need to click on settings – ad inserter

You are now presented with the home screen of ad inserter.

To get to the head section then click on the gear icon (next to 15)

Scroll down a bit and you will see all the tabs for general, viewports, hooks, header, footer, ad blocking and debugging…

The one we want is the header.

Copy the google tag code and paste it into the dark box

Just above this box to the right you will see three buttons.

The middle one looks like a grey circle

Click on this and it will turn green – this means you have switched on this section.

Click on save settings and the code is added to your site.

Verify this by visiting your site and right clicking – select view source

And when the new tab opens search ( using ctrl+f) for UA- and it should take you to the tag code.

Testing the code is inserted correctly

if you want to see if traffic will be shown on your site correctly then google does have a method of sending test traffic.

In your google analytics account navigate to admin – tracking info – tracking code

Here right next to your tracking code is a button for sending test traffic.

Remember that this is not instant, but clicking on this will open a new window and show you where google will send one traffic.

Checking this window is your site homepage, shows that you have added the correct property.

It can take up to 3 minutes and it can seem like a lifetime….

But then you will see the counter change from 0 to 1 if you have added the code correctly.

Adding search console

The other half of the google analytic tools – which are worth having – is search console ( used to be called google webmasters)

You will need to sign up for an account at

After you sign up you can add your property ( site)

If you have access to the dns section of your site then add the file.

If you have no idea what the dns section is then choose the right hand panel and enter your site url.

Click continue and it will come up with a panel for verifying your property.

If it cannot find the google analytics code it will request another form of verification.

I tend to scroll down and use the HTML tag

Copy the tag and paste it into the ad inserter head section and click save all

Go back to search console and click on verify for the HTML tag ( that’s important)

A popup panel will come up and tell you whether it has verified the site or not.

Once verified it is in the list and will start to gather data.

As with most things on this side of the web – it is not instant and can take a few days to weeks ( depending on how active your site is) to start to gather data.

With search console you will see unusual queries come and go out of the query table fairly quickly.

This is google trying keywords for articles to see the relevance – it still can’t process like a human.

It will settle down over the next few weeks, so give it time….

Overview of search console

Search console is a useful tool where utilising the performance menu item you see an overall of your site over the last 3 months.

Scrolling down slightly gives you the queries and pages ( with a sort of rank) that google thinks you are relevant for.

Clicking in a query then on the pages tab shows which page the query is relevant to…

And you can go the other way – click on the x by the query to get rid of it – then find one of your pages and click on queries and you are shown the keywords related to that pages.

If you want to see your latest rank then set the time frame at the top to ‘most recent date’ and this will show the latest rank rather than the average…some pages drop off the serps and the average shows them still there…

Do you need to optimize it …do you need to change them…

And by clicking on url inspection you can add any new articles for that property and get them in the index queue as soon as possible.

You can find if you have any problems with google within the security and manual actions settings…

Useful data

Going back to google analytics – this can be useful to have an overview of users  behaviour…how many visitors you useful data can be analysed to help you business succeed

have – where the are coming from…where they go on your site….

You can see live data of visitors on your site and that is exciting for the first time – seeing them swapping pages and staying on your site – reading the articles you have created …and then they are gone …onto the next site…

So what do you need to do to keep them on your site and change readers into buyers….

Improving your site

With Google analytics you can find the more popular pages and see if there is a trend in any category – concentrate on this category going forward, or increase the marketing effort on the other categories…

You can find out whether certain countries are visiting your site and bias you articles towards their culture…

Are your visitors using desktop or mobile – although google has taken it on itself to push mobile – maybe your visitors are on a desktop more than a mobile and you can design the pages to suit.

Do you need google analysis tools

You don’t have to add these tools…

But unless you have another way of measuring what is going on then you have no feedback on what you are producing…

And the best way for a business to move forward is to measure its performance…

In this case to see what your visitors are consuming…

There are paid applications matomo, foxmetrics and others that allow you to create reports that are useful to you from data they collect.

They can be expensive for the new starter, so i would recommend adding the google analytics at the start and see how you get on.

So to help your business grow and to gain valuable feedback from your visitors you need some form of tracking.

You also need to be able to customize data for your needs and google allows you to do this.

You can learn a lot more about how to use Google analytics in a series of webinars in the training i am involved with.

Wealthy affiliates has a weekly webinar on current or trending topics.

Here’s a snapshot of a few for google analytics….webinar replays are available for premium members only

So if you want to improve the performance of your site with google analytics it is worth getting onboard with Wealthy affiliates.

To view the webinars you do need to be a premium member, but joining for free you get the first levels of both their courses, access to talk to the very active community for 7 days, a website to follow along with the lessons, thousands of community created articles and training to browse through.

And all that for free, so why not just check it out – what have you got to lose….

Click the button below to setup your account and you will soon be on the inside…

get your free membership

If You Liked it - Why Not Share It- Click Below

Leave a Reply

Your email address will not be published.