Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wpperformance/wp-performance-partytown
Partytown in your WordPress
https://github.com/wpperformance/wp-performance-partytown
partytown wordpress wordpress-plugin
Last synced: 7 days ago
JSON representation
Partytown in your WordPress
- Host: GitHub
- URL: https://github.com/wpperformance/wp-performance-partytown
- Owner: wpperformance
- Created: 2022-10-11T19:32:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T10:02:13.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T11:46:36.707Z (19 days ago)
- Topics: partytown, wordpress, wordpress-plugin
- Language: JavaScript
- Homepage:
- Size: 91.8 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Partytown in your WordPress
### 🚨 Be careful, the proxy php is a experimental code. You can use it, but i'm not responsible of the security of your website
This plugin add [Partytown](https://partytown.builder.io/) available for your website
If you use proxy, set the cache lifetime to max 8h for avoid nonce bug.
## For use Proxy PHP, add this line in your wp-config.php.
☝🏻 use it only if you know what you do
```
define('PR_PROXY', true);
```The proxy is only necessary when service don't have ```Access-Control-Allow-Origin: *``` in response.
For example, Google Analytics, has this CORS headers.
More informations, [here](https://partytown.builder.io/proxying-requests)## Define proxy key for connected users. In your wp-config.php
```
define('PR_PROXY_KEY', 'key of your choice');
```## Debug => In your wp-config.php
```
define('PR_DEBUG', true);
```## Add script for partytown
Juste add type "text/partytown" in `````` tag
Example :
```
<!-- Google Tag Manager -->
<script type="text/partytown">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','');```
## Launch partytown parsing after cookie acceptation
Dispatch load event for trigger partytown parsing.
```
const load = new Event('load');
window.dispatchEvent(load)
```