Skip to content

Commit

Permalink
Merge pull request #70 from estartando-devs/feature/implement-ga
Browse files Browse the repository at this point in the history
feat: initial setup for google analytics
  • Loading branch information
jonataspinto authored Mar 6, 2022
2 parents 4591e8e + 7c8f897 commit 1b1f0fc
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/components/Analytics/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';

export const Analytics = () => (
<>
<script
async
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA_TRACKING}`}
/>
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
</>
);
2 changes: 1 addition & 1 deletion src/components/StudentProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const StudentProfile = ({ title }: StudentProfileProps) => {
<S.Container>
<S.TextBox>
<S.TitleProfile dangerouslySetInnerHTML={{ __html: title }} />
<S.DescriptionProfile>
<S.DescriptionProfile as="span">
Buscamos pessoas que gostem de desafios, sejam determinadas e
responsáveis. Nossa formação é totalmente <strong>gratuita.</strong> A
única coisa que cobramos é <strong>dedicação.</strong>
Expand Down
6 changes: 6 additions & 0 deletions src/components/StudentProfile/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export const DescriptionProfile = styled(Typography).attrs({
font-weight: normal;
line-height: 1.7rem;
font-size: 1.25rem;
color: ${({ theme }) => theme.palette.design.white};
ul {
padding-left: 2rem;
}
strong {
color: ${({ theme }) => theme.palette.primary.main};
Expand Down
4 changes: 4 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function App({ Component, pageProps }: AppProps) {
<ThemeProvider theme={theme}>
<Head>
<title>Estartando Devs</title>
<meta
name="google-site-verification"
content="8kDtWUmUQEh7QXoj_shRaxcgYAVpHs_YQ7TeniN0kmI"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#81CAA8" />
<meta name="apple-mobile-web-app-status-bar-style" content="#81CAA8" />
Expand Down
2 changes: 2 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Document, {
} from 'next/document';
import React from 'react';
import { ServerStyleSheet } from 'styled-components';
import { Analytics } from '../components/Analytics';

export default class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext) {
Expand Down Expand Up @@ -62,6 +63,7 @@ export default class MyDocument extends Document {
<body>
<Main />
<NextScript />
<Analytics />
</body>
</Html>
);
Expand Down

0 comments on commit 1b1f0fc

Please sign in to comment.