This step is not needed; if a Magento or WordPress plugin are used, which generate a reliable dataLayer on the confirmation and cart pages.
There are 5 possible ways to triggering a thankyou page:
- {{dataLayer.google_tag_params.ecomm_pagetype}} = purchase
- {{dataLayer.ecommerce.purchase.actionField.id}} not like ^(undefined)?$
- {{dataLayer.event}}=transaction
- {{js_document.title}}=Thankyou for Ordering
- {{url path}}=/thankyou.html
IMPORTANT: Option4{{url path}} is case sensitive in rules & lookup tables. Thus applying lowercase patch and remove trailing “/” via a jsmacro is recommended to increase triggering accuracy. Also {{url path}} triggers will break if the page is renamed to /new-thankyou-2.html
DataLayer based{{pagetype}} & {{Event}} methods will continue to work if the URL is changed . They do not require maintenance and are a better long term solution.
<!– Examples of a dataLayer for confirmation pages –>
<script>
// Adwords remarketing dataLayer
dataLayer = [{“google_tag_params”: {“ecomm_pagetype”: “purchase“} }];
// GTM dataLayer
dataLayer = [{“page.category.pageType”: “confirmation“,”event”: “transaction“}];
// W3C digitalData layer v1.0
window.digitalData.page = {“category”: {“pageType”: “confirmation“}};
// Qubit universal_variable dataLayer v1.2.1
window.universal_variable.page = {“type”: “confirmation“};
</script>
IMPORTANT: When deploying GTM on multiple CMS, when the dataLayer is added in stages a hybrid approach is necessary, to ensure that sale confirmation rule always triggers. This uses a cascading URL lookup table, here is an example: