TraceSignals

GA4 Setup Explained

📊
GA4 Setup Explained

GA4 Setup Explained

Google Analytics 4 (GA4) is the newest analytics platform from Google. It replaces Universal Analytics and adds event‑based tracking, cross‑platform reporting, and deeper integration with Google Ads. For Shopify and WordPress store owners who run paid ads, setting up GA4 correctly is essential to measure traffic, understand shopper behavior, and optimize ad spend.

Why Switch to Google Analytics 4

GA4 provides a single data model for web and app events. This means you no longer need to define separate goals and funnels for each platform. Instead, every interaction—page view, product click, add‑to‑cart, purchase—is recorded as an event. The platform also offers predictive metrics that help you identify high‑value audiences automatically.

Another reason to switch is compliance. GA4 includes built‑in data‑retention controls and more granular consent options, making it easier to meet privacy regulations such as GDPR and CCPA. Finally, Google has announced that Universal Analytics will stop processing new data in July 2024, so migrating now ensures you won’t lose any historical insights.

Create a GA4 Property and Data Stream

  1. Log in to your Google Analytics account at analytics.google.com. If you only have a Universal Analytics property, click the Admin gear icon in the lower‑left corner.
  2. In the Account column, select the account that will own the new property.
  3. In the Property column, click Create Property. Enter a property name (e.g., “My Store – GA4”), select the reporting time zone, and choose the appropriate currency.
  4. When prompted for the property type, choose Web. This creates a data stream for your website.
  5. Enter your website URL, give the stream a name (e.g., “Shopify Store”), and click Create Stream. The platform will generate a Measurement ID that looks like G-XXXXXXXXXX.
  6. Copy the Measurement ID. You will need it when adding the tag to your site.

Install the GA4 Tag on WordPress and Shopify

  • WordPress – The easiest way is to use a dedicated plugin. Install the TraceSignals Conversion Tracking plugin, activate it, and paste your GA4 Measurement ID into the plugin settings. The plugin automatically inserts the required gtag.js script on every page and also supports Google Ads and Meta Pixel tracking.
  • If you prefer a manual approach, add the following snippet to your theme’s header.php just before the closing </head> tag:
    <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 Measurement ID.
  • Shopify – From your Shopify admin, go to Online Store > Preferences. Scroll to the Google Analytics section, click Add custom JavaScript, and paste the same gtag.js snippet. Save the changes. Shopify’s theme editor also allows you to insert the code directly into the theme.liquid file before the closing </head> tag.

Configure Conversion Tracking for Paid Ads

  1. Identify the key actions you want to track as conversions (e.g., Purchase, Add to Cart, Sign‑up). These events must be sent to GA4 from your site.
  2. For Shopify, enable the built‑in events: go to Settings > Checkout and turn on Track checkout events. This automatically fires the purchase event with transaction details.
  3. For WordPress, use the TraceSignals plugin to map form submissions, button clicks, or custom JavaScript events to GA4. In the plugin dashboard, click Add Event, choose the event name (e.g., add_to_cart), and define the trigger selector (e.g., .add-to-cart-button).
  4. After events are firing, go back to GA4. In the left navigation, select Configure > Events. Verify that your custom events appear in the list.
  5. Mark the events as conversions: in the Events table, toggle the Mark as conversion switch next to each event you want to count as a conversion. GA4 will now treat those events as key performance indicators for Google Ads reporting.
  6. Link GA4 to Google Ads: in GA4, navigate to Admin > Product Linking > Google Ads Linking. Select the appropriate Google Ads account and follow the prompts. This linking enables automatic import of GA4 conversions into Google Ads.

Validate Your Setup and Keep Data Clean

Once the tags are live, you must confirm that data is flowing correctly. Use the Realtime report in GA4 to see live activity from your own browser. If you don’t see any activity, double‑check the Measurement ID and ensure the gtag.js script loads without errors (use the browser’s developer console).

Next, test each conversion event. In Chrome, open the Tag Assistant extension, perform the action (e.g., click “Add to Cart”), and verify that the correct event name appears in the debug view. For Shopify, you can also use the “Purchase” test order in the sandbox mode.

Finally, set up data filters to exclude internal traffic. In GA4, go to Admin > Data Settings > Data Filters, create a filter for your own IP address range, and mark it as Excluded. This prevents your own visits from contaminating conversion metrics.

By following these steps, you will have a fully functional GA4 implementation that tracks website activity, captures paid‑ad conversions, and provides reliable data for optimization. Regularly review the Events and Conversions reports, adjust event parameters as your store evolves, and keep your tagging up to date with any platform changes.

Frequently Asked Questions

How do I create a GA4 property and link it to my website?

Log into Google Analytics, click 'Create Property', select 'Web', and enter your site name and URL. Then copy the provided Measurement ID and paste it into your site's global site tag (gtag.js) or Tag Manager container to activate tracking.

What is the difference between a data stream and a property in GA4?

A GA4 property is the top‑level container for all your analytics data, while a data stream is a specific source within that property, such as a website, iOS app, or Android app. Each stream has its own Measurement ID and collects data separately under the same property.

How can I verify that GA4 tracking is working correctly after setup?

Use the Realtime report in the GA4 interface to see live events from your site, or enable the DebugView in Tag Manager and open your site with the GA Debugger extension. If page_view and other events appear, the implementation is successful.

What are the essential events I should enable by default in GA4?

GA4 automatically tracks enhanced measurement events like page_view, scroll, outbound clicks, site search, video engagement, and file downloads. For most tutorials, these defaults are sufficient, but you can also configure custom events for specific conversion goals.

Related Articles