Git Product home page Git Product logo

ga_nextjs's Introduction

This nextjs app is an exmaple of implementing google analytics

Installing the dependencies

npm run dev
or 
yarn
npm run dev
or 
yarn dev
  1. Create an app on firebase https://firebase.google.com/
  2. Make sure you're logged in with the same google account and then open https://analytics.google.com/analytics/web to see the google analytics dashboard
  3. Select app on the Top-left second button
  4. Setup stream if not already by going to the stream setup page entering the website name and url
  5. Create a pages/_document.tsx file - refer code
  6. Create .env.local file and append the following key to it
NEXT_PUBLIC_GOOGLE_ANALYTICS=<Your google tracking id>
  1. Add lib/ga folder to add custom events
  2. Make changes similar to _app.tsx to listen to route change events
  3. Refer pages/index.tsx to log custom events with params

ga_nextjs's People

Contributors

100lvlmaster avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.