search
HomeBackend DevelopmentPHP TutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

How to calculate the time on site and the time on page, calculate the time on siteto calculate the time on site and the time on page, calculate the time on site_PHP tutorial>

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Time on Site (hereinafter referred to as Ts) and Time on Page (hereinafter referred to as Tp) are important indicators for user experience analysis and traffic quality monitoring. But few people know how the average time on site (Average Time on Site) is calculated. Whether you use a competitive intelligence analysis tool or some kind of website analysis solution (in the website analysis solution, whether it is WebLog or JavaScript tag data, few people know how to calculate the average website visit time).

Therefore, the purpose of writing this article is to explain clearly how Tp and Ts are calculated.

Case How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:

Someone visits your website homepage, and your website analysis tool starts counting How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial Session for this visitor. The visitor then browses two more pages and then leaves your site (leaving the site can be by closing the browser, typing a different URL in the address bar, or clicking on a link on your site to another site) Link...) For the sake of simplicity, we treat this process as a Session.

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Here’s what we want to know:

Tp = Time spent on a page (Time spent on a page);

Ts = the total time the user spent on the entire website (Time spent on the website).

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Assume this session starts at How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:00:

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Currently, all website analysis tools can accurately know the time when a page access request occurs, but this is not enough to explain how many Tp and Ts there are, because we need more information:

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

The user did not bounce, and clicked a link on the homepage to jump to page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. The current website analysis tool can also obtain the opening time of page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial, and it can know that it is the same user, so it can be easily calculated Tp from the home page:

Tp(Home) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:0How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial – How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:00 = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes.

Some content on page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial attracted the user, so the user continued to visit page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Look from the picture above:

Tp(page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial0 – How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:0How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes.

The user exits from page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial, ending the session:

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

So, how long did this user stay on page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial? The problem arises because all current website analysis tools do not capture the "time stamp" when the user leaves page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial, so we cannot calculate how long the user stayed on page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial! Therefore:

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = 0 minutes.

Because the request time of the next page cannot be provided! Web analytics tools don't know how long a user spent on the last page of a session. This is true for most web analytics tools.

Let us use the following figure to represent the dwell time of each page website analysis tool statistics:

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Tp (Home) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = 0 minutes

So, how long does this Session stay on the entire website?

Ts = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial0 minutes

Is it reasonable?

I think it may not be reasonable, because you don’t know how much time the visitor spent on the last page, so the time statistics given by the website analysis tool will generally be less than the actual time the user stays on the website.

Case How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:

How are Time on Site and Time on Page calculated when browsing the website with a multi-Tab browser?

Firefox's multi-tab page browsing method has earned it a reputation, but it has caused trouble when it comes to calculating Time on Page and Time on Site. When a user opens a link to the same website in another tab, that is, browses the same website through two tabs at the same time, how will Time on Page and Time on Site be calculated?

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

This situation confuses the calculation of time by website analysis tools.

The picture below is a common user browsing website scenario. Through this scenario, we can understand the impact of multi-tab page browsing...

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

  • A user comes to the homepage in the picture above, and then opens a link on this page in a new tab. At this time, the homepage occupies one tab page, and the newly opened page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial after clicking the link occupies another tab page. .
  • At this time, the user does not close page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial after browsing page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial, and returns to the home page using Tab to continue browsing the home page.
  • While browsing the homepage, the user clicked another link on the homepage and jumped to page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial, but no new tab was opened. The current tab page was opened.
  • Then, the user switches to the tab where page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial is located, clicks the link to enter page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial, and closes the current tab on page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial.
  • Then, the user clicks the link on page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial to go to page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Of course, it is still the same tab. Finally, close the tab on page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial and the session ends.

How to calculate Time on Site in this case? Different website analysis tools have two calculation methods for this "multi-tab type" browsing behavior.

Method How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:

The website analysis tool records the above multi-Tab browsing situation one by one according to different tabs, that is, the following calculation occurs:

Statistical result output: How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial access processes (i.e. How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial Sessions), each Session corresponds to a Tab.

SessionHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial (Tab where the homepage is located in the picture above):

Tp (Home) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = 0 minutes

Ts (the entire visit duration of the same Tab) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial0 minutes

SessionHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial (Tab where page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial is located in the picture above):

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = 0 minutes

Ts (the entire access time of the newly opened Tab) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

In this case: How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial Sessions and How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial UV (Unique Visitor) will be recorded in the report of the website analysis tool.

Method How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial:

Some website analysis tools will merge multiple tabs into the same access process to eliminate the impact of multiple tabs (tab pages).

It’s still the same example as above, but let’s change the presentation method - the picture below shows the same process, and different colors represent different Tabs.

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Statistical result output: How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial access process (i.e. How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial Session), which contains two Tabs. The entire access process is reorganized as shown above through "time stamps".

This Session:

Tp (Home) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minute

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = 0 minutes

Ts = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial0 minutes

Which statistical method do you think is more reasonable, and which method do you prefer?

Please be sure to ask your website analysis service provider which of the above two methods they use to calculate the time and access process of multi-Tab (tab page) browsing.

More and more people are now using multi-tab browsing, so which method you choose will have a huge impact on the final data output of your website analysis - there is no doubt that the final data of the two methods will definitely There will be obvious differences.

Solution:

Get the page (Tab) closing time (The page can be closed by closing the browser or Tab page, or typing a different URL in the address bar, or clicking on a link to another website on your website link...)

The latest user experience visual analysis tool "Bang Analysis" independently developed by Tribe State (Beijing) Technology Co., Ltd. obtains the page closing time. By calculating the time difference between page opening and closing, you can easily and accurately obtain the page stay. time and session time.

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

This Session:

Tp (Home) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minute

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Tp (page How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial) = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

Ts = How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial minutes

The time on page is accurately obtained, but how significant is it? We will discuss it in detail in the next article, so stay tuned!

Reprinted from: http://www.bangfx.com/research/?p=How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial

Calculate the time spent on a certain web pageto calculate the time on site and the time on page, calculate the time on site_PHP tutorial>

Use js code to write two functions. One is called when the web page is loaded. Make a timer in this function to get the current system time. Call it when the web page exits. Then stop the timer in the function that exits the web page. Then do a time calculation and subtract the time when the web page is loaded from the time when it stops to calculate the time the web page stays

How to effectively increase the time on page?to calculate the time on site and the time on page, calculate the time on site_PHP tutorial>

How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Study the three functions of residence time:
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. The longer the entire website residence time, the higher the search engine’s evaluation (weight) of the website.
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Study the residence time of a single page to understand the user's access behavior and improve the page.
Residence time is only one factor that search engines consider the quality of a website
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Whether the page design is reasonable, this is also the best reflection of the browsing habits of the product. Know what information is useful to users!
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Stay on the homepage The longer the time, the better. The longer the list page (entry) is not, the longer the better. The longer the product page stays, the better.
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. The home page should be concise, or it should be easier to see what he wants, easy to understand, and clearly classified.
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. The list page must have a filtering function, so that users can find the content they want faster.
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Rich content: detailed product introduction, multiple photos of physical products, reviews, similar products (the combination of pictures and text reduces users’ reading fatigue)
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. The text content is readable and the fonts size
How to calculate the time on site and the time on page, calculate the time on site_PHP tutorial. Expand user needs: open a different directory and related recommendations

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/How to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorialHow to calculate the time on site and the time on page, calculate the time on site_PHP tutorial.htmlTechArticleHow to calculate the time on site and the time on page, calculate the time on site (Time on Site, hereinafter referred to as Ts) and Time on Page (Time on Page, briefly below...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor