Stape/Documentation

Stape Global CDN

You have several CDN options for configuring a custom domain in Stape: Stape Global CDN, Own CDN, or have CDN Disabled. In this article, we’ll cover Stape Global CDN.

Stape Global CDN is a Cloudflare-powered content delivery network feature that serves key JavaScript files (such as gtm.js and gtag.js) from servers closer to a user’s geographic location. Reducing the distance between the server and the user means that page elements load faster, which improves the user experience and site performance.

Stape Global CDN is available for all server-side GTM subscription plans.

Important! Please consider your country's privacy regulations before enabling CDN.

Benefits of Stape Global CDN

  • Faster page load times - serving JavaScript files from geographically closer servers decreases latency, resulting in quicker page loads. Improved load times can enhance user engagement and reduce bounce rates.
  • Better SEO performance - search engines factor in page speed when ranking sites. Utilizing the Global CDN can help you achieve a more efficient load time, potentially improving search engine visibility.
  • Simple setup & maintenance - enabling the Global CDN only requires a quick toggle in your sGTM container settings and adding a CNAME record. Stape handles the heavy lifting of managing the CDN behind the scenes.

How to use Stape Global CDN

This instruction considers that you’re looking to use Stape’s Global CDN as your CDN. If you’d like to configure your Own CDN instead, please refer to this guide.

1. Log in to your stape.io account.

2. Select your sGTM container on the dashboard.

Select your sGTM container

3. Scroll down and click Add custom domain.

click Add custom domain

4. There are two ways of adding a custom domain:

Two ways of adding a custom domain
  • Automatically (via Entri) - the easiest way to connect domains. Log in with your DNS provider details via Entri, and give us one-time permission to connect your domain. Check the full list of supported DNS providers by Entri.
  • Manually - After you add a custom domain to your Stape container, you will see DNS records that should be added to your DNS provider to verify the custom domain. The DNS records depend on the server location and which CDN options you choose.

Here are all available configurations for your custom domain (don’t worry, we’ll cover the configuration process later):

  • Domain name - enter your tagging server domain (example: gtm.my-domain.com).
  • Add CDN - toggle this switch if you want to load js files (gtm.js, gtag.js, analytics.js, etc.) from a server closer to your site’s visitors, resulting in a faster js file serving.
    • Select the Stape Global CDN option - it loads scripts from a server closer to users visiting your website.
  • Advanced settings - here you can tick the box to Use A records instead of CNAME records. If DNS providers restrict adding duplicate records, you should use CNAME record. If not, then choose A records. Please note that this setting is incompatible with the Add Global CDN setting.
Available configurations for your custom domain

5. Enter your Domain name, toggle Add CDN → select Stape Global CDN → select whether you want to connect Automatically or Manually → click Next.

Enter domain data

You will be provided with two CNAME records. Here is an example of how to add these records to Cloudflare DNS provider, but you can do the same with any provider you use.

6. Visit your Cloudflare profile → open the DNS tab in the side menu → open the Records screen → click Add record. 

Add record in Cloudlfare

7. Enter the DNS records from Stape: 

  • Type - select CNAME.
  • Name - copy the HOST parameter from Stape.
  • Target - copy the VALUE parameter from Stape.
  • Proxy status - make sure to toggle this OFF.

Repeat the process of adding records for each CNAME record that Stape provided you. After that, click Save.

Enter the DNS records from Stape

8. Once you’ve entered the DNS records to your DNS provider, return to the Stape domain settings page and click Verify.

Click Verify to add custom domain

9. Wait for Stape to finish verifying your custom domain (when the container status bar changes from Verifying to Ready). Usually, it takes from 30 minutes to 2 hours, but in some cases it can take up to 72 hours.

Wait for Stape to finish verifying your custom domain

10. Go to your Google Tag Manager Server container → click Admin → click Container Settings → change the Tagging server URL to your subdomain.

Change the Tagging server URL to your subdomain

Testing Stape Global CDN

To verify that the custom domain is working properly, open its URL and add load. at the start and  /healthy at the end (e.g., https://load.sgtm.stape.work/healthy). If everything is correct, you should see the OK response.

Testing Stape Global CDN
Can’t find what you are looking for?