Comments (2)
I'm using resolveUrl
in many projects and it seems to work fine. See: https://www.partydawn.top/?sgtm&pt
It uses the following settings code:
const params = new URLSearchParams(location.search);
const pt = params.has("pt");
const xhrfetch = params.has("xhrfetch");
const xhrallow = params.has("xhrallow");
partytown = {
forward: pt ? ["dataLayer.push"] : [],
allowXhrCredentials: xhrallow,
debug: true,
logCalls: true,
logGetters: true,
logSetters: true,
logImageRequests: true,
logScriptExecution: true,
logSendBeaconRequests: true,
logStackTraces: false,
};
if (xhrfetch) {
partytown.resolveUrl = function (url, location, type) {
if (type === "script" && url.host !== "proxy.partydawn.top") {
const proxyUrl = new URL("https://proxy.partydawn.top/api/partytown/proxy");
proxyUrl.searchParams.set("url", url.href);
proxyUrl.searchParams.set("xhrfetch", true);
return proxyUrl;
}
return url;
};
} else {
partytown.resolveUrl = function (url, location, type) {
if (type === "script" && url.host !== "proxy.partydawn.top") {
const proxyUrl = new URL("https://proxy.partydawn.top/api/partytown/proxy");
proxyUrl.searchParams.set("url", url.href);
return proxyUrl;
}
return url;
};
}
from partytown.
Same here resolveUrl
not fired i nextjs app
<Partytown
debug={true}
resolveUrl={(url, location, type) => {
console.log(url);
return url;
}}
forward={['dataLayer.push']}
/>
<script
key="plugin-google-tagmanager"
type="text/partytown"
dangerouslySetInnerHTML={{
__html: `(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','${GOOGLE_TAG_MANAGER}');`,
}}
/>
Other props like logScriptExecution
don't work too.
So only debug and forward props works fine for Partytown
component.
from partytown.
Related Issues (20)
- [🐞] Web Worker Does Not Allow `withCredentials` for XHR Requests
- [🐞] Google Tag Assistant Preview is not showing tags (Google Tag Manager) while using Partytown HOT 1
- [📖] How can I load partytown from a pure HTML/JS website? HOT 1
- [🐞]partytown throws error in chrome developer console and not able to connect to GTM preview mode HOT 13
- [🐞]404 errror throws while implementing partytown in gatsby application HOT 3
- Failed to register a ServiceWorker for scope ('https://example/~partytown/') with script ('https://example.com/~partytown/partytown-sw.js'): The script resource is behind a redirect, which is disallowed. HOT 1
- Partytown integration with Astro makes over 10'000 proxytown requests on page load[🐞] HOT 2
- [🐞] Google Tag Manager NextJS forward events coming as blank []
- [🐞] Cannot read property 'Error' of null
- [🐞] Proxy object could not be cloned HOT 1
- [🐞] Firefox: 404 partytown-sandbox-sw.html HOT 1
- [🐞] Firefox: Private Browsing for external Scripts HOT 1
- [🐞] GA4 sessions plummeted after migration of GTM to Partytown HOT 11
- [🐞] Objects and object properties can't be forwarded HOT 2
- [🐞]in statement is not reliable when running through partytown
- [📖] resolveSendBeaconRequestParameters missing in docs and React types HOT 1
- [🐞]: forwarding gtm dataLayer.push breaks immediate dataLayer pushes HOT 3
- [🐞] page_view and on_load events are not firing in GA4
- [🐞] Intercom does not work with party town HOT 1
- [🐞]user_engagement is not working in GA4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from partytown.