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

  • Similar Topics

    • EU Citizens - Know your consumer rights!

      Many people see ToS agreements between a seller and a consumer as above the law. Sellers in particular seem to think if you agree to a ToS, no matter what it consists of, that you cannot break the contract no matter what. Certainly, Escape From Tarkov's Russian developers Battlestate Games are definitely of this opinion with their shady ToS agreement which states:     "11.4.2. Any, including one-time, breach by the User of the conditions hereof or of the Key Documents, as well as the terms for u

      in The Open Castle Inn

    • What are your favourite games?

      As the title says! What are your favourite games of all time? Whether it's down to the game mechanics, the concept, or the story! Let me know, and why! I should add, this is excluding any games from the Stronghold franchise :P     For me, it's a difficult decision between SWAT 4 and the Titanfall 2 campaign. I love those games. SWAT 4 has such a charm to it for its age, and the game mechanics are so clever and unique, I can't get enough of it! As for Titanfall 2, the story is amazing.

      in The Open Castle Inn

    • Google Poll

      I stupidly left my coursework until the last minute and a part of the coursework requires me to gather first hand data for the question I decided on. Because of the subject matter, this poll is only including citizens of the United States or the United Kingdom. Your personal information will not be needed, and any information presented by Google will be kept anonymous. Thank you!   Poll link -?https://docs.google.com/forms/d/e/1FAIpQLSfHPoX2XLdOrBxsv3e2h095ZpWcP1IrDOYnL33gnolgGnD-Nw/viewform?usp

      in The Open Castle Inn

    • how to access source code for stronghold crusader and their mods

      I am a great fan of the stronghold series and programmer with knowledge in c c++ and java.i would like to make mods of my own for stronghold and also would like to contribute to the already existing mods in any way possible But i don't know how/where to access the source codes for stronghold,stronghold crusader,stronghold europe mod and stronghold medival mod.I learnt from eagleprince that contacting the admins here like lordchris cybercorpse would solve my problem.so i am posting it here.thank

      in Stronghold Crusader & Crusader Extreme

    • How to edit Stronghold crusader (not extreme) trail?

      Anyone know? Im interrested in changing it and im looking for people that know it. I was told that Stronghold europe knows it but i dont know who to contact personally or so.?

      in Stronghold Crusader & Crusader Extreme

×
×
  • Create New...