Closed samizarraa closed 3 years ago
Hi Any news to fix this issue. Thanks
This fix will be included in the next update! Sorry for not getting to this sooner.
@samizarraa I've taken a look at this issue and decided to not include it in the newest release yet. While the 'document is not defined' error can indeed be fixed by injecting the DOCUMENT from @angular/common, the Facebook script is still not accessible from within the service.
I'll be doing some more research on how to resolve this issue to add support for SSR.
Great work on the plugin, it's a really handy tool to have.
As for SSR, You don't need to fire pixel events serverside, if anything its better not to or you'll have events firing twice, just simply surround the doucment reference in a isPlatformBrowser check surely?
Really need this to be updated as im trying to put a commercial project live, if you can't manage it in the next day or two please let me know and I'll work on another solution.
@syn6UK right now I'm not getting any fired events at all. I don't know if I'll be able to get this fixed on the next two days, but of course I'd be more than happy to accept a PR or code snippet if you manage to find a solution!
I'll have a crack at it, i'll keep you updated.
Can you give me write permissions to upload my branch?
@syn6UK only the 'main' branch should be protected. What branch are you trying to push to?
I've put a pull request in now :) Sorry, lack of coffee!
@syn6UK Thanks! I'll review in the morning
Can confirm from testing on my production site, it works fine!
@syn6UK @NielsKersic Hi Actually, I no longer use the plugin due to the Facebook Pixel added to Google Tags manager.
Are you using a plugin for this or vanilla js integration?
I just use Facebook tag template in google tags manager and after that just add pixel id, Done
@syn6UK I've just published a new release (1.1.0) with added SSR support :)
Hi Please can you Inject Document instead of use it directly @Inject(DOCUMENT) private readonly doc: Document I want to use it in SSR
Thanks