PH Ranking - Online Knowledge Base - 2025-09-05

Manual GA4 Installation: Embedding the Global Site Tag in Website Code

To manually install Google Analytics 4 (GA4) by embedding the Global Site Tag (gtag.js) in your website code, follow these key steps:

  1. Create a GA4 Property

    • Log in to your Google Analytics account.
    • Create a new GA4 property by entering a property name, time zone, and currency.
    • Complete the setup by agreeing to the terms of service.
  2. Get the Global Site Tag (gtag.js) Code

    • After creating the property, go to the "Data Streams" section in GA4.
    • Select your web data stream and find the Global Site Tag snippet. It looks like a JavaScript code block starting with <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script> followed by a script initializing gtag with your Measurement ID.
  3. Embed the Global Site Tag in Your Website

    • Copy the entire Global Site Tag code snippet.
    • Paste it into the <head> section of every webpage you want to track, ideally right before the closing </head> tag. This ensures the tag loads early and collects data accurately.
  4. Verify Installation

    • Use tools like Google Tag Assistant or the GA4 real-time reports to confirm that data is being sent correctly from your website.

This manual method directly adds the GA4 tracking code to your site without using Google Tag Manager, giving you straightforward control over the tracking script. It requires access to your website’s HTML or CMS backend to insert the code.

Summary of the Global Site Tag embedding:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXXXXX');
</script>

Replace G-XXXXXXXXXX with your actual GA4 Measurement ID.

This approach is recommended if you prefer manual control or do not use Google Tag Manager.

Internet images

Ang PH Ranking ay nag-aalok ng pinakamataas na kalidad ng mga serbisyo sa website traffic sa Pilipinas. Nagbibigay kami ng iba’t ibang uri ng serbisyo sa trapiko para sa aming mga kliyente, kabilang ang website traffic, desktop traffic, mobile traffic, Google traffic, search traffic, eCommerce traffic, YouTube traffic, at TikTok traffic. Ang aming website ay may 100% kasiyahan ng customer, kaya maaari kang bumili ng malaking dami ng SEO traffic online nang may kumpiyansa. Sa halagang 720 PHP bawat buwan, maaari mong agad pataasin ang trapiko sa website, pagandahin ang SEO performance, at pataasin ang iyong mga benta!

Nahihirapan bang pumili ng traffic package? Makipag-ugnayan sa amin, at tutulungan ka ng aming staff.

Libreng Konsultasyon

Free consultation Customer support

Need help choosing a plan? Please fill out the form on the right and we will get back to you!

Fill the
form