Jump to content
Andreas9541

How do you edit your websites source code for google analytics?

Recommended Posts

So I have this website for about a month and I want to put a tracking code in the source code of the pages on my website. The problem is I don't know how to edit the damn source code. Google analytics says I have to copy and paste the following snippet in the source code of the page that I want to track;

 


 

Ok fine but how the f*** do I edit the code? I have been searching on google how to do this on google chrome but I still have't found a way. I stopped before throwing my laptop on the wall. My computer skills are primitive so I would appreciate a little help on this.

Edited by Lord_Chris
Added code tags

Share this post


Link to post
Share on other sites

Without knowing your website layout it's almost impossible to tell. Templates? Is there a template anywhere? I assume you'll be using PHP, so do you have the HTML in the standard PHP file mixed with it or have it separate?

 

The Google Analytics code should go in the

section of the document: https://support.google.com/analytics/answer/1008080?hl=en

 

Paste it into your web page, just before the closing tag.

 

One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the

section, and we recommend placing the snippet at the bottom of the section for best performance


Quote

The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post


Link to post
Share on other sites
?so do you have the HTML in the standard PHP file mixed with it or have it separate?

I have no idea. How do I check that?

Basically I want to do whatever this guy does:

He has a bar on the upper hand of his browser that allows him to edit the code of his website and I want to do that too.

Share this post


Link to post
Share on other sites

Are you referring to Dreamweaver here? That's just software for editing files locally on your computer. It's expensive software though, and not all that good.


Quote

The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post


Link to post
Share on other sites

Damn I just looked it up and it is expensive. How did you put the tracking code in the code of your pages? Basically what is the simplest way of editing the code?

Edited by Lord_Chris
Removed unnecessary quote of previous post

Share this post


Link to post
Share on other sites

Well as I said earlier, it depends on how your site is configured. It's pretty much like the question how long is a piece of string. Is the site stored locally, or on a webserver? If it's local, just open it in a text editor such as Notepad, or Notepad ++ (free, which is what I use). If it's stored on a webserver, then your host should have given you some kind of FTP or online file manager you can use to edit it.


Quote

The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post


Link to post
Share on other sites

So I created an FTP account from my webhost and it was suggested to edit a file named index.html but I have no idea how to find this file. I have an application that lets me edit this file (filezila) but I don't know how to find it.

 

Update:

 

So here is my situation now. I found a file named 'Index.php' but not the file 'index.html'. How do I find the html file from my file manager?

1324743760_filemanager.thumb.png.9f6df615f2a7621260e2d70332c02786.png

Edited by Andreas9541

Share this post


Link to post
Share on other sites

Looks like you're using WordPress, your hosts' advice will not be valid for it - obviously it was some generic advice ...

 

See this link for WordPress specific: http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/


Quote

The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post


Link to post
Share on other sites

Chris thanks a lot for the guidance. After a bit of time I logged in to my cPanel, opened the file manager and found the index.html file of all my pages and pasted the tracking code at the end of the header.

 

I logged into google analytics and now I can see the traffic. :)?

 

You can mark this as answered post if there is a thing like that in the forum. XD

Edited by Andreas9541

Share this post


Link to post
Share on other sites

Good to hear the issue was resolved. :)


Quote

The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...