Controlling Amazon CloudFront CDN cache keys
As the Anonymised tag uses a call-back to initialise the persisted browser id, a query string will be passed in the request. Where Amazon’s CloudFront CDN is being used, cache key configuration may be required to avoid cache busting.
Below is our suggested best practice for handling query string parameters. We recommend that you speak to your webmaster or infrastructure teams regarding this matter when you are readying domains for deployment.
Cache key
The cache key is the unique identifier for every object in the cache, and it determines whether a request results in a cache hit.
You can get better performance from your website or application when you have a higher cache hit ratio (a higher proportion of requests that result in a cache hit). One way to improve your cache hit ratio is to include only the minimum necessary values in the cache key.
Removing the parameters from the call-back request will maintain this performance.
Cache key settings
These specify the values in requests that CloudFront includes in the cache key. The values can include URL query strings, HTTP headers, and cookies.
The query string settings for the Cache key which are compatible with running the tag; including the occasion of the callback are:
None – The query strings in requests are not included in the cache key and are not automatically included in origin requests.
Include all query strings except – You specify which of the query strings in requests are not included in the cache key and are not automatically included in origin requests. All other query strings, except for the ones you specify, are included in the cache key and automatically included in origin requests.
In this case, you would need to enter the following query strings not to be included:callback
state
code
Creating or modifying Cache policies
You can create and modify a cache policy in the CloudFront console, with the AWS Command Line Interface (AWS CLI), or with the CloudFront API.
For more information on this, please read the Amazon support article: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html
Recommendations
As per Amazons recommendations, we support using the Cache policy and origin request policy over the Legacy cache settings, see screenshot below:-

AWS CloudFront Cache key and origin requests
The recommended Cache key settings should look like this:-

AWS CloudFront Cache key settings
Should your installation not be compatible with the above recommendations, please notify your Client Success Manager or a member of support.
Related articles
- Anonymised tag alternative deployments
- Comparison with Web Analytics
- Controlling Amazon CloudFront CDN cache keys
- Install the Anonymised tag natively
- Install the Anonymised tag using Adobe Launch
- Install the Anonymised tag using Google Tag Manager
- Integration with Consent Management Platforms
- Marketing tag deployment considerations
- Marketing Tag Installation
- Optional Anonymised tag parameters
- Safeguarding your Web Analytics
- Understanding the Anonymised Data Account