Skip to content

Commit

Permalink
Merge pull request #65 from xwp/fix/init-377-report-TTFB
Browse files Browse the repository at this point in the history
Fix/init 377 report ttfb
  • Loading branch information
mehigh committed Mar 17, 2022
2 parents 641112a + be872f4 commit 6be53c6
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ All contributions are welcome! Please create [an issue](https://github.com/xwp/s

### Changelog

#### 1.1.5 - March 17, 2022

- Adding TTFB.

#### 1.1.4 - March 10, 2022

- Improve performance by loading and executing the script in quiter periods.
Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function zipBundle() {
'README.md',
'css/**/*.css',
'js/dist/**/*.js',
'js/dist/**/*.php',
'php/**/*.php',
],
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/module/web-vitals-analytics.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'cf1c2747697c8b76d7b0f75ae6382e16');
<?php return array('dependencies' => array(), 'version' => '8f75cb271429178c9035de39e1f2f8d8');

This file was deleted.

3 changes: 2 additions & 1 deletion js/src/measure-web-vitals.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { sendToAnalytics } from './send-to-analytics';
import { getCLS, getFCP, getFID, getLCP } from 'web-vitals';
import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';

export function measureWebVitals() {
getCLS( sendToAnalytics );
getFCP( sendToAnalytics );
getFID( sendToAnalytics );
getLCP( sendToAnalytics );
getTTFB( sendToAnalytics );
}
1 change: 1 addition & 0 deletions js/src/send-to-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const vitalThresholds = {
FCP: [ 1800, 3000 ],
FID: [ 100, 300 ],
LCP: [ 2500, 4000 ],
TTFB: [ 501, 1500 ],
};

const uaDimMeasurementVersion = window.webVitalsAnalyticsData[ 0 ].measurementVersion
Expand Down
2 changes: 1 addition & 1 deletion site-performance-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Plugin Name: Site Performance Tracker
* Plugin URI: https://github.com/xwp/site-performance-tracker
* Description: Allows you to detect and track site performance metrics.
* Version: 1.1.4
* Version: 1.1.5
* Author: XWP.co
* Author URI: https://xwp.co
*/
Expand Down

0 comments on commit 6be53c6

Please sign in to comment.