As part of the planning phase, it is necessary to determine which framework is going to be used for listening for DOM changes. You need to pick one – not both.
Advantages
- TMS agnostic – can be migrated from GTM to Qubit or via-versa.
- Existing jQuery events can be piggybacked
- If large website or complex markup then jQuery can handle the logic in one customHTML tag rather than several.
- Lots of native functions, easier to traverse selectors and lots of 3rd party customisations.
Disadvantages
- Requires Developer resources
- Requires consistent version of jQuery site-wide:
<script src=”//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script>
or <script src=”//code.jquery.com/jquery-latest.min.js”></script>
- If not possible to load via CDN (e.g banking website) then this will cause latency issues as there is a large initial download.
Advantages
- Standardised version deployed sitewide
- Easier for non-developers to enabled
- Will soon support better UI for selecting button classes etc
- Built in JS error tracking
- If a tag importing is introduced – then it will be easier to enable functions.
Disadvantages
- Can be stomped-on by jQuery or other JS append events
- Creates a dependency on native GTM function, making it harder to change from GTM.
- Only support 6 functions
- pageError
- formSubmit
- click
- linkClick
- historyChange
- timer
- Additional functions such as change selectors for menu links can be added via customHTML triggered via “event”: “header_datalayer_loaded”.
Note: Both methods require reliable markup of unique IDs, classes and data-attributes