Enter your search

Adding gzip compression to the GoSquared Tracking Code

How we reduced data transfer by 40%

gzip CDN bandwidth difference

For years we’ve been serving our tracking code (the GSTC) through a global Content Delivery Network (CDN) called CloudFront.

CloudFront replicates our GSTC across the world allowing us to deliver it in the fastest possible time to your visitors.

Our original setup meant CloudFront was loading our code from a minified, but uncompressed file on S3. Most modern web browsers support gzip compression to reduce bandwidth, and using the CDN pointing straight to S3 meant this couldn’t be enabled.

The solution? Using our NginX cluster as the CDN’s origin. That way, the CDN loads the tracker from our nginx cluster, which in turn loads it from S3 and compresses it before passing it to the CDN. The CDN then caches and distributes this compressed code to its edge locations.

The results have been much bigger than we first expected, reducing the CDN data transfer amount by 40% but also, more importantly, further improving load times for the tracker for website visitors.

Written by
Lead developer at GoSquared for integrations, partnerships and the API. Works on pretty much everything.

You May Also Like

Group 5 Created with Sketch. Group 11 Created with Sketch. CLOSE ICON Created with Sketch. icon-microphone Group 9 Created with Sketch. CLOSE ICON Created with Sketch. SEARCH ICON Created with Sketch. Group 4 Created with Sketch. Path Created with Sketch. Group 5 Created with Sketch.