-
Notifications
You must be signed in to change notification settings - Fork 57
FAQ
- What is the relationship between Google Tag Manager and DAP?
- How do we send custom events to DAP?
- Does DAP provide a Subresource Integrity hash?
If you have a tag manager on your site, you can use it to deploy the DAP code to your site. (For instructions on how to do so, see the DAP Quick Technical Guide.) That is the extent of the relationship.
You don't need a tag manager to install DAP. The easiest way to install DAP is to insert a one-line script tag in your site code. The only reason to install DAP with a tag manager is if your site uses additional Google Marketing Platform products, including your own, separate Google Analytics accounts, and you already have a tag manager installed to manage those.
You cannot use your own tag manager, if you have one, to update which events you send to DAP. Or rather, you kind of can, but it won't work the way you want it to and you shouldn't do so. For an explanation, go here.
You cannot use DAP's tag manager to update which events you send to DAP, because DAP does not use a tag manager. DAP's functionality is exactly that which is defined by the DAP script. The functionality only changes when we release a new version of the DAP script.
Generally speaking, you can't.
DAP is not designed to support the free addition of custom events by our agency customers. DAP has its own schema of events, which are designed to be broadly applicable across the federal government. The DAP team adds custom dimensions and metrics to the DAP properties to support the tracking of these events and builds custom reports to display these events. The schema of DAP events consists of:
- GA4 automatically collected events
- Some GA4 enhanced measurement events, which are collected automatically (page views, outbound clicks, site search, video_start, video_progress, and video_complete, file_download)
- Some GA4 recommended events, which are collected automatically (share)
- CLS, INP and LCP events for Core Web Vitals tracking
- The list of events defined by the
gas4()function
The gas4() function does offer the catch-all dap_event event, which allows you to send a generic event to DAP with arbitrary parameters. However, unlike a true custom event, you cannot control the name of the event and you will not be able to define new custom dimensions and metrics to capture additional parameters.
// 'Event name' dimension will be 'dap_event'
// 'link_text' parameter will populate the 'Link Text' dimension because DAP has defined it as a custom dimension
// 'link_color' parameter will not be available through the Google Analytics UI because DAP has not defined it as a custom dimension
gas4('dap_event', {
'link_text': 'Download Report',
'link_color': 'green'
});If you want to track an event that is not currently in the DAP schema, your best option is to track it in a separate Google Analytics property that you manage yourself. The DAP script can live side-by-side with other gtag or GTM scripts on your site.
If the new event you want to track could be considered 'broadly applicable across the federal government', you are welcome to suggest it to the DAP team, via our issue tracker or by sending email to dap@gsa.gov.
No. DAP does not publish Subresource Integrity (SRI) hashes for the centrally hosted script.
SRI hashes are tied to an exact byte-for-byte version of a file — if the file changes at all, a browser enforcing the hash will refuse to load the script. Because DAP pushes updates to the centrally hosted URL frequently (new features, bug fixes, GA4 enhancements), a fixed SRI hash would break your implementation every time DAP releases a new version.
The central hosting model is intentional: it allows the DAP team to deliver updates to all participating agencies seamlessly, without requiring each agency to redeploy. Locking to a specific hash would negate that benefit.
If your security policy requires SRI for third-party scripts, the alternative is to self-host the DAP code — but note that you would then be responsible for keeping your version of DAP up-to-date.