How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Richard Your Own Question
Richard
Richard, Software Engineer
Category: Software
Satisfied Customers: 36526
Experience:  Software Systems Specialist.
32989067
Type Your Software Question Here...
Richard is online now

I need to use Google Analytics on my very basic WordPress website.

Resolved Question:

I need to use Google Analytics on my very basic WordPress website. GA have requested that I put the code below on every page that I want tracked. Where should this code be added?
Please note this is specific to a WordPress site. I'm not sure whether the code below will appear as given to me by Google.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-DANGEROUS URL REMOVED','ga');
ga('create', 'UA-***90456-2', 'auto');
ga('send', 'pageview');
Submitted: 1 year ago.
Category: Software
Expert:  Richard replied 1 year ago.
Thank you for your question, my name is ***** ***** I look forward to assisting you.
Please note, a rating is only needed when we are finished.
the code you have, paste it in your theme’s header.php right after the tag on your site.
Once added, save and it will then run each the page is opened.
Let me know the results please
Customer: replied 1 year ago.

Thank you for your quick reply, Richard. I've found the header.php, but what do you mean by the 'tag on your site'?

Also, as I'm dealing with WordPress and PHP (?) I'm a bit concerned about following their advice about php.

See: h t t p://postimg.org/image/hvanqgqnj/

Expert:  Richard replied 1 year ago.
ok, the text was removed here as its HTML but you copy this code
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-DANGEROUS URL REMOVED','ga');
ga('create', 'UA-***90456-2', 'auto');
ga('send', 'pageview');
after the
Body
Tag that's in the brackets
Customer: replied 1 year ago.

Thanks - and the php query?

Expert:  Richard replied 1 year ago.
No as they are doing it a different way to how we are, the way I have you do it is simpler.
Richard and 2 other Software Specialists are ready to help you

Related Software Questions