Skip to content

Commit

Permalink
feat: GA 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jan 31, 2024
1 parent f77e912 commit bd81d4f
Show file tree
Hide file tree
Showing 14 changed files with 826 additions and 267 deletions.
29 changes: 0 additions & 29 deletions app/app/app.css

This file was deleted.

58 changes: 0 additions & 58 deletions app/app/layout.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions app/links/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import {useEffect, useState} from "react";
import Image from "next/image";
import bbibbiMain from '../../../public/bbibbi_main.svg'
import {usePathname, useSearchParams} from "next/navigation";
import {analytics} from "@/firebase/firebase";

export default function Page() {
const id = usePathname()?.split("/")?.pop();
const [platform, setPlatform] = useState<"unknown" | "ios" | "android">("unknown");
const iosTargetUrl = 'https://no5ing.kr/o/'+id + '?retry=1';
useEffect(() => {
analytics;
const detectPlatform = () => {
const unknownWindow = ((window as unknown) as any);
const userAgent = navigator.userAgent || navigator.vendor || unknownWindow.opera;
Expand Down
29 changes: 0 additions & 29 deletions app/links/globals.css

This file was deleted.

56 changes: 0 additions & 56 deletions app/links/layout.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/links/page.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions app/o/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Image from "next/image";
import bbibbiMain from '../../../public/bbibbi_main.svg'
import {usePathname, useSearchParams} from "next/navigation";
import axios from "axios";
import {analytics} from "@/firebase/firebase";

export default function Page() {
const id = usePathname()?.split("/")?.pop();
Expand All @@ -13,6 +14,7 @@ export default function Page() {
const [platform, setPlatform] = useState<"unknown" | "ios" | "android">("unknown");
const retry = searchParams?.get("retry");
useEffect(() => {
analytics;
const detectPlatform = () => {
const unknownWindow = ((window as unknown) as any);
const userAgent = navigator.userAgent || navigator.vendor || unknownWindow.opera;
Expand Down
29 changes: 0 additions & 29 deletions app/o/globals.css

This file was deleted.

56 changes: 0 additions & 56 deletions app/o/layout.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/o/page.tsx

This file was deleted.

24 changes: 24 additions & 0 deletions firebase/firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {FirebaseApp, getApps, initializeApp} from "firebase/app";
import {Analytics, getAnalytics, isSupported} from "firebase/analytics";

const firebaseConfig = {
apiKey: process.env.NEXT_PUBLIC_API_KEY,
authDomain: process.env.NEXT_PUBLIC_AUTH_DOMAIN,
projectId: process.env.NEXT_PUBLIC_PROJECT_ID,
appId: process.env.NEXT_PUBLIC_APP_ID,
storageBucket: process.env.NEXT_PUBLIC_STORAGE_BUCKET,
messagingSenderId: process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID,
measurementId: process.env.NEXT_PUBLIC_MEASUREMENT_ID,
};
let app: FirebaseApp;
let analytics: Analytics;
if (typeof window !== 'undefined' && !getApps().length) {
app = initializeApp(firebaseConfig);
isSupported().then((yes) => {
if(yes) {
analytics = getAnalytics(app);
}
});
}

export {app, analytics};
Loading

0 comments on commit bd81d4f

Please sign in to comment.