Monthly Archives: December 2020

how to set up a @vercel #react #next project to use a @google global site tag (@google analytics) #webdev #seo

how to set up a @vercel #react #next project to use a @google global site tag (@google analytics) #webdev #seo

simple usage

  • set a vercel env var GTAG to your google tag id
  • add /pages/_document.js to your project

/pages/_document.js

import Document, { Html, Head, Main, NextScript } from 'next/document'

export default class MyDocument extends Document {
  render() {
    var gtag = process.env.GTAG
    return (
      <Html>
        <Head>
          {/* Global Site Tag (gtag.js) - Google Analytics */}
          <script
            async
            src={`https://www.googletagmanager.com/gtag/js?id=${gtag}`}
          />
          <script
            dangerouslySetInnerHTML={{
              __html: `
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());
            gtag('config', '${gtag}', {
              page_path: window.location.pathname,
            });
          `,
            }}
          />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    )
  }
}

advanced google site tag pageviews and events usage

google site tag & google analytics statistics

realtime map of locations of users

web analytics the #nocode way with @vercel #react #next #analytics #seo #webdev

web analytics the #nocode way with @vercel #next #analytics #seo #webdev

if you are using @vercel #react #next 10 + you can add web analytics with a #nocode single click

the old goog anal way was (Analytics Academy (google.com)

the new vercel way (Analytics – Vercel Documentation)

  • login to vercel
  • chose a vercel next 10 project and click enable analytics

HOWEVER FREE ACCOUNT ONLY REMEMBERS ANALYTICS FOR ONE DAY AND ONLY ON ONE SITE

ibm @centosproject #alt @redhat #rhel 8 #RHD #RHSN subscription registration quickstart

ibm @centosproject #alt @redhat #rhel 8 #RHD #RHSN subscription registration quickstart