Comments (9)
@steve8708 Hey Guys, update from my side. My code was un-registering the party town script before running it, so that's why the problem was occurring. Thanks for all the response and help!!
from partytown.
@shailander May I know how did you figure out if party-town script is getting registered or not. Iām facing the above same issue so.
from partytown.
@gowdanischal7 @cyrilcabo I had a script to register and de-register all the service workers used. Party town also operates as a service worker so my script was removing/de-registering the partytown as soon as it was initialised. I checked this through the source option in console panel where the partytown was seen initialising as also being removed when my scripts run. This was causing that error shown in the issue as partytown is itself not present during the external script load call
from partytown.
Ahh I see, it seems like I have a different problem. Thanks for taking the time to respond @shailander !
from partytown.
Hi @shailander
I think script tags don't work inside _document.tsx
. You should put the Script Tags inside _app.tsx
or inside the components where you want to load the Scripts according to Next.js Guide. See here:
- https://nextjs.org/docs/messages/no-head-import-in-document
- https://nextjs.org/docs/basic-features/script
Also, if you use Next.js built-in <Script />
tag, there are ESLint rules making sure everything is configured as it should be.
_document.tsx
import { Partytown } from '@builder.io/partytown/react';
import Document, { Head, Html, Main, NextScript } from 'next/document';
import React from 'react';
class CustomDocument extends Document {
render(): JSX.Element {
return (
<Html>
<Head>
<Partytown forward={['dataLayer.push']} />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default CustomDocument;
home.tsx
import Script from 'next/script'
export default function Home() {
return (
<>
<Script src="https://www.google-analytics.com/analytics.js" />
<h1>Title</h1>
</>
)
}
from partytown.
Hi @meck93, thanks for the response.
Although Script
doesn't work in _document but script
does work if you want but is still a bad practice.
Using next Script is not even making the call to download the script, and I wanted to globally download the gtag so that's why I have to use it in _app
but even after moving the scripts to the _app
the problem still persists.
from partytown.
I'm also getting the same issue. My proxytown request is pending & when checked in partytown-sw file, it says Unexpected end of input.
from partytown.
hey @shailander - we've just created an issue template, could you update your issue here to provide all the information the template asks for? it'll help us look into your issue https://github.com/BuilderIO/partytown/issues/new?assignees=&labels=&template=bug_report.md&title=
pasting below to make things easier:
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Reproduction link
Please include a link to a Stackblitz or Codesandbox reproducing the issue. We will need to see the issue reproduced with hand-written code - we can't debug giant minified third party scripts directly. If you do not include a clean and simple reproduction of your issue, we won't be able to look into it until you do.
Expected behavior
A clear and concise description of what you expected to happen.
Partytown version
What version of Partytown you are using, e.g. 0.0.1
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
from partytown.
@shailander I hope you can come back and tell us what you did to fix the issue š¢ š
from partytown.
Related Issues (20)
- [š] 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
- [š] AppsFlyer Smart Banner does not work
- [š] How to setup correctly partytown for astro.js HOT 1
- [š] GTM doesnt work HOT 1
- [š] "NoParty" error in Safari
- [š] Partytown Shopify Integration Failed to execute 'postMessage' on 'Worker'
- [š] Partytown Shopify Integration Failed to execute 'postMessage' on 'Worker'
- [š]batching not work
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.