Skip to content

Stape Integration

Stape is a server-side container hosting solution that simplifies the process of deploying and managing server-side containers. It provides a user-friendly interface and various features to enhance performance and security.

Create a Stape Account

If you do not have one, create a Stape account here. Once you have an account, follow the steps below to set up your server-side container.

Create a Stape Server Side Container

  1. In your Stape dashboard, click sGTM
  2. click on Create sGTM container

  1. Enter a container name (it doesn't have to match your GTM container name).
  2. Paste the Container Config you copied from GTM.
  3. Select a server location that's geographically close to your target audience.
  4. Click on Create Container.

  1. Choose a Stape plan (they offer a free tier to start).
  2. Click on Continue to proceed with the setup.

Setup Custom Domain

  1. Click Add custom domain.
  2. Enter a Domain name (e.g., metrics.yourdomain.com).
  3. Enable Add CDN to improve the loading times
  4. Select Stape CDN or use your Own CDN
  5. Select Manually to get DNS Instructions
  6. Click Next to set up the custom domain.

Info

  • To prevent detection by advanced ad blockers that often target subdomains like gtm, stape, taggrs, or similars, consider using different, less predictable subdomains for your integration.
  • The Domain name is the value to set up on module configuration GA4 tab, Server Container URL input field.

  1. Set up the CNAME or A records and add it to your domain DNS settings.
  2. Click Verify in Stape to confirm the DNS are correctly deployed.

Info

The Verification process may take a few minutes, depending on your DNS provider.

Configure Stape Power-Ups

Custom Loader

Custom loader is a Stape feature that allows you to load the GTM container in a more efficient way, improving performance and reducing the impact of ad blockers.

  1. In your Stape dashboard, click over sGTM and select your GTM container.
  2. Click on Power-Ups tab.
  3. On Custom Loader panel click on Use.

  1. Enable the feature.
  2. Click on Save Changes.

  1. Select the Domain ( previously configured ).
  2. Add your Web GTM ID.
  3. Enable Ga4 ad block bypass.
  4. Add Same Origin Path to extend the route of your Server Container URL.
  5. Select Other Platform
  6. Set Data Layer Variable Name, leave it empty for default value.
  7. Select Generate with CDN
  8. Disable Use original GTM code.
  9. Click on Generate.
  10. Check the generated code and follow the next instructions.

Server Container URL

The Server Container URL is crucial for sending events to your server-side container and enabling the Tag Assistant feature in GTM, which helps with debugging and testing your site.

Based on the previous configuration screenshot, the Server Container URL for this example is: https://metricstp.reactioncode.com

Set this URL in the module configuration GA4 tab, Server Container URL input field, and in the GTM Container Settings in the Server Container URLs input field.

Info

Make sure the URL does not end with a slash. Both the GA4 Module Configuration and GTM Container Settings must use the exact same Server Container URL.

Module Configuration From Stape Code

Warning

The stape code below is only an example do not use it, you must create your own code in your stape account.

Example Stape Script With Custom Loader
    <!-- Google Tag Manager -->
    <script>
        (function(w,d,s,l,i){
            w[l]=w[l]||[];
            w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});
            var f=d.getElementsByTagName(s)[0],j=d.createElement(s);
            j.async=true;
            j.src="https://load.metricstp.reactioncode.com/2rqhgioesoz.js?"+i;
            f.parentNode.insertBefore(j,f);
        })(window,document,'script','dataLayer','cnfl0o=aWQ9R1RNLVBLQjNIUTM%3D&apiKey=fbf0cf8');
    </script>

    <!-- End Google Tag Manager -->
Next parameters are located in module configuration Tag Manager tab.

  • Script URL: https://load.metricstp.reactioncode.com/2rqhgioesoz.js
  • Query ID Parameter: cnfl0o
  • Override Tracking ID: aWQ9R1RNLVBLQjNIUTM%3D&apiKey=fbf0cf8

GEO Headers

GEO Headers is a Stape feature that allows you to send the user's location to the server-side container, improving data accuracy and reducing the impact of ad blockers.

  1. In your Stape dashboard, click over sGTM and select your GTM container.
  2. Click on Power-Ups tab.
  3. On GEO Headers panel click on Use.

  1. Enable the feature.
  2. Click on Save Changes.