Skip to content

SSR support added - #193

Open
jabiinfante wants to merge 1 commit into
mzuccaroli:masterfrom
jabiinfante:ssr_support
Open

SSR support added#193
jabiinfante wants to merge 1 commit into
mzuccaroli:masterfrom
jabiinfante:ssr_support

Conversation

@jabiinfante

Copy link
Copy Markdown

First and foremost, thank you for your library. It has proven to be extremely useful.

While implementing Angular SSR (Server-Side Rendering) with @angular-devkit/build-angular:application, we encountered the same issue reported in #159 and #50.

In addition to resolving the "document not defined" error, I found it noteworthy that the SSR functionality appends the tag immediately after the tag, in accordance with Google's recommendations.

Regarding my contribution, I've made modifications to the addGtmToDom function to differentiate between PlatformServer and PlatformBrowser. Drawing inspiration from the code snippet provided in the Angular Platform Browser's meta service, I incorporated logic to include the tag (as seen here) within the DOM object for SSR scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant