Google analytics for different .html files in the same domain - html

Let's say that my website is www.myWebsite.com.
I have set up google analytics in index.html file properly and I get all the statistics fine in my dashboard.
Now my website has also got other html files, in the folder: www.myWebsite.com/folder/file1.html and www.myWebsite.com/folder/file2.html.
I want to track these pages too, and get how many view each page has.
In order to do this, do I have to use the same scripting code from analytics that I got for www.myWebsite.com ? And should the dashboard appear each page's views separately? Or do I have to set up different code for these pages?
I hope that I explained my problem well. Thank you in advance :)

Yes, you need to include the Analytics tracking code into the source code on every page you wish to track. This means including it in index.html and file1.html etc.
You can find more info in the Google Analytics help page.

You have to include generated code in every page that you wish to track.

Related

Why isn't my HTML page loading completely?

I recently started my first HTML project with the help of Youtube. I'm a beginner and only saw the basics of Javascript in college.
Just finished writing my HTML project and wanted to upload it for free using Google Drive and drv.tw.
The only problem is that certain images and icons do not load (irregularly) enter image description hereand/or the pages on the navigation bar take too long to switch.
My question would be, is it because of the free domain or did I do something wrong in HTML?
When I open the HTML file in Safari everything works fine.
Since I'm new to the community, I don't know exactly what and how much I have to upload to get help. So have mercy on me :'D.
To help troubleshoot, use your browsers "developer" (F12) mode. Look at the Network view to see why the images aren't displayed. For example: It might be "not found", "not authorized", or other reasons.
From your comment, it would appear that at times the page is rendering before the images are available to display or something else is limiting image files from being presented at all.
Once we know why the browser can't display the images, then the cause can be addressed.
Post the .html .js and .css code
Please update your question and show the folder structure. It should look something like:
-site-
|
-js
-css
-images
Copy and paste in the code below the folder structure and list the images and their size.
I am not familiar with google drive's capabilities.
It is important to use a web host. There are plenty of free or low cost sites available, so I won't go into it.

when people go to my website it shows all my files and not the landing page of my website -mclosed

when I go to my website directory it shows all my files and not to my landing page, is there a way to fix this? I have tried everything even looked through the internet without any clear response. I am close to finishing my website I only need to resolve this problem.
Thank you!
The issue seems to be that you are not on the HTML file, but on the folder.
To fix this issue, you have to redirect yourself to the HTML landing page.
/ar/home.html
This should show your HTML landing page correctly rendered.
Tip: Normally, the main page is called index.html by convention. This can be helpful. For example, the Live Server extension on Visual Studio Code will automatically go to index.html if the file isn't specified. Other hosting services, like GitHub Pages, also do the same.
None of the extensions, IDEs and hosting services listed above are sponsored! They are just used for the sole purpose of examples.
In conclusion, you need to go to the HTML file, instead of the folder.

Google Analytics - Multiple pages and single header

My webpage is compose from more "pages". For example:
www.webpage.com/home.php
www.webpage.com/registration.php
www.webpage.com/contacts.php
...etc
But all my pages have the same , because I include the same head in all of my pages.
My question so far:
1.) Is good to place the google analytics script in my head?
2.) If someone goes from www.webpage.com/home.php to www.webpage.com/registration.php it will count it as two visit of my page?
Thx
its okay to place google analytics script in your head. google analytics is java script and is run only after the page is loaded into your browser. So each page will be individually recognized.
Yes. Google actually recommends to put the code in the header
Paste your snippet (unaltered, in its entirety) into every web page
you want to track. Paste it immediately before the closing
tag.
One of the reasons is that GA has a report on page timings. The timer is started when the tracking code is loaded, so if you insert the code later in the page the timing reports might be off.
If you have the tracking code in all pages and GA can set cookies properly then the two calls to the pages will be tracked as two pageviews, but only one session/visit.

Count JS/CSS file usage

I am doing research on usage of JS/CSS files on website. Let me put it this way. I want to (automatically) visit every page on website and make statistics how many times was JS/CSS file used (included into page).
Is there any tool for this or will better to write own script, which will open every anchor link within the same domain, and look into HTML header for JS/CSS file existence?
Thanks for replies.
Late to the party but for the record...
I would highly suggest checking out PhantomJS and CasperJS

opening html from google drive

I have made a page in html5 with css3. It works fine on local (I dont use any server, just doubleclick in the index to open it).
I want to put it in google drive. I have load all the documents needed, but when I try to open the html, I can only see the text (I mean, it is not being executing, I can see just the source code).
Any suggestion?
Not available any more, https://support.google.com/drive/answer/2881970?hl=en
Host web pages with Google Drive
Note: This feature will not be available after August 31, 2016.
I highly recommend https://www.heroku.com/ and https://www.netlify.com/
EDIT: As of August 2016 Google Drive can no longer be used to host static web pages, so this solution no longer works.
Create a new folder in Drive and share it as "Public on the web."
Upload your content files to this folder.
Right click on your folder and click on Details.
Copy Hosting URL and paste it on your browser.(e.g. https://googledrive.com/host/0B716ywBKT84AcHZfMWgtNk5aeXM)
It will launch index.html if it exist in your folder other wise list all files in your folder.
I don't think it is necessary to "host" the content using the way from the accepted answer. It is too complicated for a normal user with limited developing skills.
Google actually has provided hosting feature without using Drive SDK/API, what you need is just few clicks. Check this out:
http://support.google.com/drive/bin/answer.py?hl=en&answer=2881970
It is the same to the answer of user1557669. However, in step 4, the URL is not correct, it is like:
https://drive.google.com/#folders/...
To get the correct host URL. Right click on the html file (you have to finish 1-3 steps first and put the html in the public shared folder), and select "Details" from the context menu. You will find the hosting URL right close to the bottom of the details panel. It should look like:
https://googledrive.com/host/.../abc.html
Then you can share the link to anyone. Happy sharing.
Now you can use
https://sites.google.com
Build internal project hubs, team sites, public-facing websites, and moreā€”all without designer, programmer, or IT help. With the new Google Sites, building websites is easy. Just drag content where you need it.
While drive allows you to edit plain text and HTML files I don't believe they allow the HTML to actually be displayed. I don't think they want people hosting websites from their drive space.
A lot of the solutions offered here do not seem to work anymore. I'm currently on a chromebook and wanted to view an HTML5 banner. This seems impossible now through Google Drive or other apps (as mentioned in previous comments).
The method I ended up using to view the HTML5 was the following:
Open Google Adwords (create a free account if you dont have one)
Click on Ads in the top panel
Click on "+AD" and choose image ad
Choose "upload an ad"
Drag and drop your zip file into the area
Click on Preview
Voila, you will see your HTML5 banners in their full beauty
There may well an easier way, but this way is pretty good too. Hope it helps and worked well for me.
Create a new folder in Drive and share it as "Public on the web."
Upload your HTML, JS & CSS files to this folder.
Open the HTML file & you will see "Preview" button in the toolbar.
Share the URL that looks like www.googledrive.com/host/... from the preview window and anyone can view your web page.
Found method to see your own html file (from here (scroll down to answer from prac): https://productforums.google.com/forum/#!topic/drive/YY_fou2vo0A)
-- use Get Link to get URL with id=... substring
-- put uc instead of open in URL