Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert: bring back gtm #423

Merged
merged 7 commits into from
Jul 25, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "typeface-inter";
import { useEffect } from "react";

import { LayoutRoot } from "~/components/layout/layout-root";
import { Script } from "~/components/script";
import config from "~/lib/config";

import type { AppProps } from "next/app";
Expand Down Expand Up @@ -82,6 +83,25 @@ export default function App({ Component, pageProps, router }: AppProps) {
<link href="/manifest.json" rel="manifest" />
<meta content="#1667C2" name="theme-color" />
</Head>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line 86 could be removed I think

<Script
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','GTM-5X4ZPBX');`,
}}
/>
<noscript>
<iframe
height="0"
src="https://www.googletagmanager.com/ns.html?id=GTM-5X4ZPBX"
style={{ display: "none", visibility: "hidden" }}
title="gtm"
width="0"
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add </iframe> instead for the noscript to work properly.

See previous implementation here: https://github.com/kawalcovid19/wargabantuwarga.com/pull/36/files?file-filters%5B%5D=.tsx

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in React, they should be identical, Mas @baraeb92.

But somehow it's not showing in the page now, could you please investigate it further, Mas @mazipan?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bisa insert expectation kode komplit nya dari GTM gak ya, Mas @baraeb92.?

Copy link
Member Author

@mazipan mazipan Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all these codes are just copy-paste from previous implementation without any modifications

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2021-07-26 at 10 50 41

It already exist, it just under main tag, should we move it under body?

</noscript>
<Component {...pageProps} />
</LayoutRoot>
);
Expand Down
19 changes: 0 additions & 19 deletions pages/home-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Page } from "~/components/layout/page";
import { PageContent } from "~/components/layout/page-content";
import { Script } from "~/components/script";
import data from "~/data/wbw.json";
import { bannerBlurData, cloudinaryLoader } from "~/lib/cloudinary-loader";
import config from "~/lib/config";
Expand Down Expand Up @@ -36,24 +35,6 @@ export default function Home(props: HomeProps) {
<Head>
<style dangerouslySetInnerHTML={{ __html: props.css }} />
</Head>
<Script
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','GTM-5X4ZPBX');`,
}}
/>
<noscript>
<iframe
height="0"
src="https://www.googletagmanager.com/ns.html?id=GTM-5X4ZPBX"
style={{ display: "none", visibility: "hidden" }}
title="gtm"
width="0"
/>
</noscript>
<header>
<div className="max-w-xl mx-auto">
<h1 className="p-0">
Expand Down