https://firebase.google.com/products/analytics?hl=ja
全部の情報はいらないっぽいな
https://firebase.google.com/docs/reference/js/firebase
// Initialize default app // Retrieve your own options values by adding a web app on // https://console.firebase.google.com firebase.initializeApp({ apiKey: "AIza....", // Auth / General Use applicationId: "1:27992087142:web:ce....", // General Use projectId: "my-firebase-project", // General Use authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database storageBucket: "YOUR_APP.appspot.com", // Storage messagingSenderId: "123456789" // Cloud Messaging });
// Initialize another app var otherApp = firebase.initializeApp({ apiKey: "AIza....", applicationId: "1:27992087142:web:ce....", projectId: "my-firebase-project", databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com", storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com" }, "nameOfOtherApp");
Vue CLiでプロジェクトを作成
$ npm install -g @vue/cli $ vue create VueTest $ cd VueTest VueTest $ npm install firebase --save
main.jsに追加
import Vue from 'vue' import App from './App.vue' import * as firebase from "firebase/app"; import "firebase/analytics"; const firebaseConfig = { apiKey: 'xxxxxxxx', projectId: 'xxxxxx', appId: 'xxxxxx', measurementId: 'xxxxxx' }; firebase.initializeApp(firebaseConfig); firebase.analytics(); Vue.config.productionTip = false // alias Vue.prototype.$analytics = firebase.analytics(); new Vue({ render: h => h(App), }).$mount('#app')
- apiKey
- projectId
- appId
- measurementId
この4つがあれば大丈夫なことがわかった。