FreePower-ups

Custom GTM and GA4 Loader

The Custom Loader power-up minimizes the impact of ad blockers on your GTM and GA4 scripts by routing them through a path that turns all cookies into first-party cookies.

Custom Loader is available on the Free subscription plan and higher. To check your current plan or upgrade, go to your sGTM container settings.

How to set up Custom Loader

1. Log in to your Stape account and select your sGTM container from the dashboard.

Log in to your Stape account and select your sGTM container from the dashboard

2. Go to Power-ups and click Use next to the Custom Loader panel.

Go to Power-ups and click Use next to the Custom Loader panel

3. Toggle the Custom Loader switch to enable it and click Save changes.

Toggle the Custom Loader switch to enable it and click Save changes

4. In the Code & Setup information section, configure the following settings:

- Domain - select one of the domains linked to your container.

- Web GTM ID - enter your web Google Tag Manager ID.

- Enhanced ad blocker protection - when enabled, all requests to your sGTM server are encrypted so ad blockers can’t block them based on request patterns. Learn more about the enhanced ad blocker protection.

- Same Origin Path - if you use the same-origin approach, enter the path here so both GTM and gtag.js load through it.

- Platform - here you can either:

  • Select your CMS platform (such as Shopify, Wordpress, etc.). In this case, you’ll be required to install and configure a Stape app. 
  • Select Other to receive a JS snippet in case you’re using another platform or a custom website.

Select your platform and click Generate. You’ll get configuration and app installation instructions in the Configuration panel for your selected platform. Follow the app installation guide.

Note: Some platforms may require you to tick the Custom Loader checkbox for the power-up to be enabled.

Select your platform and click Generate

1. Select Other. You can also configure Advanced settings:

  • Data Layer variable name - specify only if you use a non-standard dataLayer.
  • Generate with Cookie Keeper - includes Cookie Keeper logic in the generated code. This checkbox appears and is automatically enabled when you have the Cookie Keeper power-up.
  • User identifier type - appears together with Generate with Cookie Keeper. Choose how to identify users - cookie is the recommended option. When selected, enter the name of the first-party cookie to use as the identifier. For more information read How to choose user identifier type in Cookie Keeper.

2. Click Generate and add the provided code to your website.

Note: Remove the standard GTM loader from your site if you have one - running both simultaneously will cause conflicts.

Click Generate and add the provided code to your website

Testing

To verify the setup is working:

  1. Open any page on your website.
  2. Right-click → Inspect → open the Network tab.
  3. Filter requests by your custom subdomain or same-origin path.
  4. Look for the GTM request URL - it should return a 200 OK status code.
Network tab
Note: With Custom Loader and enhanced ad blocker protection enabled, GA4 request URLs will appear encrypted.

Use case

A sample scenario is an eCommerce store that sees significant data loss because a large share of its users have ad blockers installed. By enabling Custom Loader, all GTM and GA4 scripts load from a first-party domain, so ad blockers no longer recognize and block them.

You can spot the data loss this way:

  1. Compare the order count in your backend against Purchase events in GA4 for the same period. If your backend shows 500 purchases but GA4 only reports 380, the gap could be caused by ad blockers preventing the GTM script from loading in users' browsers entirely. 
  2. Enable Custom Loader. This reroutes GTM and GA4 scripts through your first-party domain, so ad blockers can no longer identify and block them by URL pattern.
  3. Monitor your GA4 Purchase event count over the same time window and compare it against your backend again.

If the gap persists after enabling Custom Loader, turn on the Enhanced ad blocker protection as well. This encrypts the request URLs so that blocking rules can't match them.

Related to this solution

Benefits of Stape hosting for server Google Tag Manager
May 6, 2026

Blog

Benefits of Stape hosting for server Google Tag Manager

Discover Stape's sGTM hosting advantages: power-ups for ad blocker bypass & data enrichment, auto-connect custom domains, autoscaling, API, and more.

What is server-side tracking?
May 4, 2026

Blog

What is server-side tracking?

Wondering what server-side tagging is and how it works? This blog post will explore all that and more!

We have more than 200 000 happy clients

Try Stape for all things server-side