title: simple google analytics way to count node.js site visits
body: <p>I have a node.js website and I seek a simple way to know if anyone is visiting it.  I have google analytics 4 on my google account panel (I created that account with google), and I want my node.js website to report site visits to it (like people are doing with Wordpress).</p>
  <p>In short, I want to go up to my google analytics panel on google and view the site visits (of a node.js website).  I am not trying to go the other way of using node.js to pull data from what I think is a google analytics API.  I am not trying to clone the google analytics dashboard on a site.</p>
  <p>This is my website.
  <a href="https://rocky-temple-91974.herokuapp.com" rel="nofollow noreferrer">https://rocky-temple-91974.herokuapp.com</a></p>
  <p>In google analytics stream I have the Measurement ID copied and ready.  Do I have to add code to my node.js website and paste in the Measurement ID?  Is there a node package I need to install in my site code?</p>
  <p>Remember I have google analytics 4 not Universal.</p>
  <p>Finally, I see everyone knows how to do this with Wordpress and Shopify.  Wordpress has a plug-in that allows you to paste in the Measurement ID.  I am thus wondering why no one says or knows anything about using google analytics 4 with node.js.  With node.js it seems no one is trying to view the site visits by logging into google analytics and using the google tool.</p>
  <p>If google analytics account viewing does not work with node.js I would like to have a code snippet for node.js that would say save counts to a file in my node.js public folder.  I am using mongoDB Atlas and another way would be to save visitor counts to mongoDB.  Any hack like that would be appreciated.</p>
  <p>I have not had any luck finding how to use google analytics for node.js (everyone knows how to use Wordpress to do it).</p>
  <p>Thanks everyone!  I feel this is a worthy question to ask.</p>