DEV Community

Manuel de la Torre
Manuel de la Torre

Posted on

Set up Customer.io HTTPS links tracking with Google Cloud Platform

I'm writing this post, because Customer.io documentation includes only information for configuring HTTPS links on other platforms but Google Cloud, and I spend like 4 hours figuring out how to solve it.

1. Create your domain in Customer.io

Sign into Customer.io and navigate to Workspace settings -> Email and click on Add Sending Domain. Now create one, for example zenfi.mx.

Go to the Link Tracking tab:

Customer.io domains config

There, you can configure your Host name (in this case email.cio) and you can see the Canonical name (e.customeriomail.com).

2. Create a GCP Load Balancer

Go to your GCP account, and navigate to Network Services -> Load balancing. Click on Create load balancer.

Choose the following options:

  • Type of load balancer: Application Load Balancer (HTTP/HTTPS)
  • Public facing or internal: Public facing (external)
  • Global or single region deployment: Best for global workloads
  • Load balancer generation: Global external Application Load Balancer
  • Click on Configure

3. Configure a frontend

  1. Set any name (eg. email-customer-io)
  2. Protocol: HTTPS
  3. IP version: IPv4
  4. ⚠️ IMPORTANT IP address: click on Create IP address, set a name and copy the created address we'll need it latter (eg. 33.100.10.14).
  5. Port: 443
  6. Certificate: click on Create a new certificate, write a name and select Create Google-managed certificate.

GCP Frontend configuration

4. Configure a backend

  1. Navigate to Backend configuration.
  2. Open the dropdown and click on Create a backend service.
  3. Write a name (eg. customer-io.
  4. Backend type: Internet network endpoint group.
  5. Protocol: HTTPS.
  6. Backends -> New backend: click on Create Internet network endpoint group. It will open a new tab, create a new group with the settings:
    1. Name: write any name (eg. customer-io)
    2. Network endpoint group type: Internet NEG (Global, regional).
    3. Scope: Global.
    4. Default port: 443.
    5. Select Fully qualified domain name and port and write the Canonical name from the Customer.io panel (eg. e.customeriomail.com).
    6. Click on Create, go back to the previous tabs and select the group you just created.
  7. ⚠️ IMPORTANT Now, open the Advanced configurations menu and go to Custom request headers. Set the following headers:
    • cname-api-key: Use the Canonical name with https (eg. https://e.customeriomail.com).
    • host: Set your domain name (eg. email.cio.zenfi.mx).
  8. Finally, click on Create.

GCP Backend configuration

Custom request headers example:

GCP Custom request headers example

5. Configure routes

  1. Navigate to Routing rules
  2. Select Advanced host and path rule.
  3. Open the default created route.
  4. Action: Route traffic to a single backend.
  5. Backend: select the one you cerated (eg. customer-io).
  6. ⚠️ IMPORTANT Add on action (URL rewrite): write the Canonical name from the Customer.io panel (eg. e.customeriomail.com).
  7. Click on Done, and finally click on Create to create the load balancer.

GCP LB routes configuration

6. Configure the DNS

  1. Navigate to Network Services -> Cloud DNS and open your DNS config.
  2. Click on Add standard.
  3. Write your the subdomain you configured in Customer.io (eg. email.cio).
  4. Resource record type: A.
  5. IPv4 Address: Paste the IP you created before (eg. 33.100.10.14).
  6. Click on Create.

GCP DNS configuration

Now you are done! GO back to Customer.io and click on Verify domain to finish your configuration.

Note: It may take a few minutes for the DNS to be propagated and the SSL certificate to be provisioned.

Top comments (0)