How to install Tag Manager in a Plasmic App?

Hello, I’m trying to install Tag Manager in a plasmic made website. I search all through the internet and here, but I couldn’t find an answer.
I know I must install it in _app.tsx so it is global in my website, but I don’t know how. I tried react-gtm-module, I tried @next/third-parties/google, I tried to insert the script using import Script from next/script, I’ve tried a lot of things.

Can someone help me?

My _app.tsx:

import ‘@/styles/globals.css’
import { PlasmicRootProvider } from “@plasmicapp/react-web”;
import type { AppProps } from “next/app”;
import Head from “next/head”;

export default function MyApp({ Component, pageProps }: AppProps) {
return (

<Component {…pageProps} />

);
}

Can you give the solution proposed here a try: Adding any kind of integration

Since Tag Manager script must be in the beggining of and beggining of , how can I do this with the embed HTML? Put in the beggining of my header? And for the ?

Sorry for the begginers questions, I’m not a programmer.

Wait a minute, I think there is a misunderstanding. That post you are pointing out (my post) is regarding any kind of integration in PLASMIC STUDIO, not in a code base.

So, are you telling me there is no way to add an integration normally on a codebase either?

Or am I confused and the project of @kalil_fagundes is not a codebase?

Please clarify this situation because I will create my codebase due to Plasmic Studio constraints in adding integrations, and if it’s not possible in the codebase either, it’s better to know it right now so I can move my project to another platform.

In case you’re still trying to figure it out, here’s an _app.tsx from one of my projects
You can replace the GTM-xxxxxxx with your own tag id

/pages/_app.tsx

//import { GoogleAnalytics } from '@next/third-parties/google'
import { GoogleTagManager } from '@next/third-parties/google'
...
export default function AcrossAllPages({ Component, pageProps }: AppProps) {
    return (
        <>
            <DataProvider>
                <Component {...pageProps} />
            </DataProvider>
            <GoogleTagManager gtmId="GTM-xxxxxxx" />
        </>
    );
};
1 Like