We wanted to implement Klaviyo dedicated click tracking on our website with respect to our emails (Understanding dedicated click tracking | Klaviyo Help Center).
Our website is hosted on Netlify and makes use of Netlify CDN. We make use of AWS Route53 as an external DNS and Klaviyo is the third party used for sending emails.
We wanted to implement this dedicated click tracking feature making use of Netlify CDN without making use of any additional CDN like Clouldflare etc.
We have tried the above making use of Netlify toml file to create a redirect but that didnt work and Klaviyo is not able to validate the CNAME.
Looking forward to any pointers/ suggestions on how to go about implementing this feature leveraging Netlify CDN and Klaviyo.
Setting up dedicated click tracking requires adding additional CNAME records to your DNS settings
…
We provide the records below, which you add into your DNS provider.
You wouldn’t implement this with a redirect on Netlify, but by adding the CNAME records they provide to your DNS. If you’re using AWS Route53 for that, then that’s where you would set it.
Yes. We added the CNAME as requested. But since the CNAME value is sendgrid.net and not Netlify’s CDN, Netlify is not able to validate it and provide an SSL to this new domain.
The Klaviyo documentation for configuring the SSL is found here:
They recommend using a third-party proxy for this like Cloudflare or Fastly. Now, it is also possible to use Netlify as the proxy instead of Cloudflare or Fastly.
This would be done by connecting the domain to a site at Netlify and then proxying to sendgrid.net. This is configured using proxy redirect rules (using Netlify as a proxy the same way you would use Cloudflare to proxy). Our docs on this are found here:
The workflow to use Netlify for the SSL would be this:
on some site at Netlify (it can be an existing site or a new site used just for this purpose) add the domain in question
configure the DNS for the domain to point to <SITE_SUBDOMAIN_HERE>.netlify.app and not to sendgrid.net (I know it sounds wrong but, please trust me, it is correct)
provision SSL at Netlify for the site to include the domain chosen (the “Renew certificate” button on the bottom of the domain management page will do this once the DNS points to Netlify)
create a proxy redirect rule that points any URLs for the domain in question to sendgrid.net
The redirect rule needed would look like this in _redirects format:
The same rule can be added in netlify.toml instead if you prefer. The syntax for netlify.toml would be this:
[[redirects]]
from = "https://<domain_name_here/*"
to = "https://sendgrid.net/:splat"
status = 200
force = true
You do not need both rules above. They are the same rule and you only need to define it one. You can declare it in just one of those two files (_redirects or netlify.toml), whichever you prefer.
Note, if you do add the domain to a new site, the site must have at least one successful deploy before we can issue SSL. Obviously, this is a non-issue if you add it to an existing site but please keep this in mind if you make a new site at Netlify for this.
To summarize, if you want to use Netlify for the SSL for the domain in question:
the DNS for domain will point to Netlify
a proxy redirect rule at Netlify will proxy the chosen domain to sendgrid.net
Again, that is just a summary and there are more detailed step-by-step instructions above. If there are any question, please let us know.
I’m trying to do something similar (see thread) but with a subdomain. What do I need to do so my redirects work? Do I need to set up my subdomain on the Domains page, with a DNS record, or other?