-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Description
Merchants will often use acquisition campaigns to drive traffic to their website and wish to record this information in Google Analytics.
Whilst the standard Varnish 4 VCL file produced by Magento contains exclusion rules for the 'gclid' parameter often seen in paid ad campaigns; it does not contain any exclusion for campaign urls.
This subsequently means that when a user renders a page and includes one of the standard campaign parameters Varnish will miss its cache and create a new version of the cached page.
The cache will also be missed for all variations of campaign url structures leading to an increased varnish cache size and a massively inefficient caching process.
Google have a standard campaign url structure and the builder which can be visited below:
https://ga-dev-tools.appspot.com/campaign-url-builder/
Preconditions
- Magento 2 CE or EE Version 2.1.7
- Varnish 4 installed
Steps to reproduce
- Install either Magento 2 EE or CE version 2.1.7
- Export the default Varnish 4 VCL from the admin panel
- Apply Varnish VCL
- Load the Magento homepage and ensure the X-Magento-Cache-Debug:HIT headers are present
- Load the same page again by applying a random campaign url i.e utm_source=test
- You will see the page is not cached by varnish
- If you load the page again you will see the page has now been cached in varnish
- Create a variation of the utm_source parameter i.e. utm_source=test2
- When inspecting the varnish headers you will see the page has not being returned from Varnish by inspecting the X-Magento-Cache-Debug:MISS headers.
Expected result
- As Magento comes with Google Analytics and AdWords integration the standard VCL file should contain additional exclusion rules for Google's standard campaign URL structure.
Actual result
- Varnish will create a new copy of the page in its cache for each variant of the campaign url structure.
For Example:
Version 1 = www.mywebsite.com
Version 2 = www.mywebsite.com?utm_source=Facebook
Version 3 = www.mywebsite.com?utm_source=Facebook&utm_medium=Remarketing
Version 4 = www.mywebsite.com?utm_source=Facebook&utm_medium=Remarketing&utm_campaign=Summer2017