Web Worker İş Yükü Dağıtımı

Açıklama

This plugin offloads JavaScript execution to a Web Worker, improving performance by freeing up the main thread. This should translate into improved Interaction to Next Paint (INP) scores.

⚠ Bu işlevsellik deneyseldir ve artık kullanımdan kaldırılması planlanıyor. ⚠

In order to opt in a script to be loaded in a worker, simply add worker script data to a registered script. For example,
if you have a script registered with the handle of foo, opt-in to offload it to a web worker by doing:

wp_script_add_data( 'foo', 'worker', true );

Unlike with the script loading strategies (async/defer), any inline before/after scripts associated with the worker-offloaded registered script will also be offloaded to the worker, whereas with the script strategies an inline after script would block the script from being delayed.

Otherwise, the plugin currently ships with built-in integrations to offload Google Analytics to a web worker for the following plugin:

Please monitor your analytics once activating to ensure all the expected events are being logged. At the same time, monitor your INP scores to check for improvement.

This plugin relies on the Partytown 🎉 library by Builder.io, released under the MIT license. This library is in beta and there are quite a few open bugs.

The Partytown configuration can be modified via the plwwo_configuration filter. For example:

<?php
add_filter( 'plwwo_configuration', function ( $config ) {
    $config['mainWindowAccessors'][] = 'wp'; // Make the wp global available in the worker (e.g. wp.i18n and wp.hooks).
    return $config;
} );

However, not all of the configuration options can be serialized to JSON in this way, for example the resolveUrl configuration is a function. To specify this, you can add an inline script as follows.

<?php
add_action(
    'wp_enqueue_scripts',
    function () {
        wp_add_inline_script(
            'web-worker-offloading',
            <<<JS
            window.partytown = {
                ...(window.partytown || {}),
                resolveUrl: (url, location, type) => {
                    if (type === 'script') {
                        const proxyUrl = new URL('https://my-reverse-proxy.example.com/');
                        proxyUrl.searchParams.append('url', url.href);
                        return proxyUrl;
                    }
                    return url;
                },
            };
            JS,
            'before'
        );
    }
);

There are also many configuration options which are not documented, so refer to the TypeScript definitions.

SSS

Devredilen komut dosyalarım neden çalışmıyor ve konsolda `partytown-sandbox-sw.html` için 404 hatası görüyorum?

Boşaltılan betikleriniz çalışmıyorsa ve aynı zamanda konsolda /wp-content/plugins/web-worker-offloading/build/partytown-sandbox-sw.html?1727389399791 dosyası için bir 404 hatası görüyorsanız, bunun nedeni büyük olasılıkla Chrome DevTools’un açık olması ve Application panelinde “Ağ için atla” seçeneğinin etkinleştirilmiş olmasıdır.

Güvenlik hatalarını nereye bildirebilirim?

Performans ekibi ve WordPress topluluğu güvenlik açıklarını ciddiye alır. Bulgularınızı sorumlu bir şekilde paylaştığınız için teşekkür ederiz ve katkılarınızı takdir etmek için her türlü çabayı göstereceğiz.

Bir güvenlik sorununu bildirmek için lütfen WordPress HackerOne programını ziyaret edin.

Eklentiye nasıl katkıda bulunabilirim?

Katkılara her zaman açığız! Nasıl katkıda bulunabileceğinizi öğrenmek için Çekirdek performans ekibi el kitabı‘na göz atın.

Eklentinin kaynak kodu, GitHub’daki WordPress/performance deposunda yer alır.

İncelemeler

9 Şubat 2026 1 yanıt
thank you, this is amazing. i had problem with google tag manager and analytics. i used this + site kit plugin and my performance went from 70 to 99. if you wanna setup tag manager/analytics manually, you should add type="text/partytown" to the script tag. like: <script type="text/partytown"> tag manager code </script> and it works like a charm!
12 Ocak 2025 1 yanıt
Problems with Google Analytics and Google Tag ManagerTested: 1 week. While Enabled: No hits, no recorded live users/users in Google Analytics. Google Tag Manager also didnt get to connect to the site. – Clarity did record users live, and page hits. This is because Clarity is not included in the built-in integrationWhile disabled: Google Analytics got hits right away – same with Google Tag Manager.
3 incelemeyi oku

Katkıda Bulunanlar ve Geliştiriciler

“Web Worker İş Yükü Dağıtımı” açık kaynaklı yazılımdır. Aşağıdaki kişiler bu eklentiye katkıda bulunmuşlardır.

Katkıda bulunanlar

“Web Worker İş Yükü Dağıtımı” 8 dile çevrildi. Katkıda bulundukları için çevirmenlere teşekkürler.

“Web Worker İş Yükü Dağıtımı” eklentisini dilinize çevirin.

Geliştirmeyle ilgilenir misiniz?

Kodu görüntüleyin, SVN deposuna göz atın ya da RSS ile geliştirme günlüğüne abone olun.

Değişiklik Kaydı

0.3.0

İyileştirmeler

  • Tüm PHP dosyalarına declare( strict_types = 1 ) eklendi. (2424)
  • Gerekli en düşük WordPress sürümü 6.9 olarak yükseltildi. (2517)
  • Gerekli en düşük PHP sürümünü 7.2’den 7.4’e yükseltildi. (2469)
  • Yerleşik özellik türleri ve daha sıkı statik analizle kod kalitesini iyileştir. (1729)

0.2.1

  • Kullanımdan kaldırılması planlanıyor. (2404)

0.2.0

İyileştirmeler

  • Web Worker İş Yükü Dağıtımı özelliğinin Google Site Kit ile entegrasyonu. (1686)
  • Web Worker İş Yükü Dağıtımı özelliğinin Rank Math SEO ile entegrasyonu. (1685)
  • SCRIPT_DEBUG etkinleştirildiğinde küçültülmemiş betikler sunulur. (1643)

Bug Fixes

  • WooCommerce entegrasyonunda add_to_cart gibi izleme olayları düzeltildi. (1740)

0.1.1

İyileştirmeler

  • Web Worker İş Yükü Dağıtımı meta generator etiketi eklendi. (1598)

0.1.0

  • İlk sürüm.