The CNAME Trick: Connecting Google Analytics to Canva with Cloudflare

My spouse is a big fan of Canva. She uses it for everything: presentations, collages, social media graphics, and—as I recently learned—websites. When she asked me to help connect Google Analytics to her new Canva site, I expected it would be straightforward.

A quick investigation confirmed the problem: Canva doesn’t offer a native analytics integration or any way to inject custom HTML or JavaScript. This makes a standard Google Analytics setup impossible on its own.

However, a solution immediately came to mind: Cloudflare, a tool I’ve used personally and professionally for years. I wasn’t sure if Cloudflare had an out-of-the-box fix, but I was confident I could find a way. Without a second thought, I updated the domain’s NS records to point to Cloudflare and, while the DNS changes propagated, started looking for a solution.

First Attempt: Cloudflare Zaraz

I quickly stumbled upon a Cloudflare article about setting up Google Analytics using their Zaraz product. It seemed perfect. I enabled the integration and… nothing happened.

This was surprising. Cloudflare changes are usually instantaneous. I spent some time debugging, but it wasn’t clear what was wrong. The Zaraz script simply wasn’t being injected, even though the site was clearly being served through Cloudflare’s network.

I searched online, asked an LLM for ideas, and dug through forums, but came up empty. Everything I read indicated it should have worked as long as Cloudflare’s proxy was enabled, which it was. 🤷

A Clue: “Orange-to-Orange”

It was getting late, and I was close to calling it a day. Then, I accidentally stumbled upon a forum thread from 2019 that mentioned something called “Orange-to-Orange” (O2O). The term, used in the context of Shopify, refers to traffic that flows from Cloudflare’s proxy to another service that is also behind Cloudflare.

A lightbulb went on: could Canva be using Cloudflare as well? A quick curl command on the IP address Canva provides for custom domains confirmed it. Awesome!

I read the thread more closely. It seemed O2O was an enterprise-only feature—a real bummer. However, I then found a developer doc suggesting that this should work for any customer, provided you point your domain to the downstream SaaS provider’s original CNAME record. This led to another roadblock: Canva only gives you an A record IP address, not a hostname to use for a CNAME.

The Breakthrough

Just as I was about to give up for the day, a final thought struck me. Canva also provides a unique subdomain for every site (e.g., {unique-name}.my.canva.site) that hosts the exact same content. Could I use that as the CNAME target?

I quickly confirmed that this subdomain pointed to an IP in the same range Canva had provided. It felt like a long shot, but I decided to give it a go. I deleted the A record and created a CNAME record for the domain, pointing it to my spouse’s unique Canva URL.

To my relief, it worked!

Cloudflare Zaraz immediately started injecting its script, and Google Analytics events started firing.

The Takeaway: A Universal Trick for SaaS Analytics

The key takeaway is that Cloudflare Zaraz can be used to manage analytics and other third-party scripts on almost any SaaS application, as long as you’re using your own custom domain.

However, a special situation arises when your SaaS provider—like Canva or Shopify—also uses Cloudflare to power its own infrastructure. In this “Orange-to-Orange” scenario, simply pointing your A record to their IP address can prevent Cloudflare features like Zaraz from working correctly.

Fortunately, a simple CNAME trick solves this problem reliably. Here’s how to get it working:

  1. Point your domain’s nameservers to Cloudflare.
  2. Ignore the A record and IP address provided by your SaaS platform. Instead, create a CNAME record for your custom domain.
  3. Point this CNAME record to the default subdomain given to you by the SaaS provider (e.g., {unique-name}.my.canva.site).

By using a CNAME record, you are explicitly telling Cloudflare that the origin of your traffic is another service also on Cloudflare’s network. This allows Cloudflare to correctly route the traffic and enables powerful features like Zaraz to function perfectly, giving you full control over your site’s analytics and scripts.