Google Tag Manager
Google Tag Manager (GTM) lets you install collection without touching your site's code. Instead of editing templates and redeploying, you add the install snippet as a tag inside GTM and publish — the change goes live the moment you hit publish, and you can manage it alongside the rest of your tags.
This page covers installing collection through GTM and pushing metadata with GTM variables.
Why use Google Tag Manager
If GTM is already running on your site, it's often the fastest path:
- No code changes — you never edit your site's source or wait on a deploy.
- One place to manage tags — collection lives with your analytics and marketing tags.
- Built-in preview — you can test the install before it touches real visitors.
If you'd rather paste the snippet directly into your pages, see Install on your website instead.
Install collection as a Custom HTML tag
Create a new tag
In your GTM container, go to Tags → New and choose Custom HTML as the tag type.
Paste the install snippet
Drop the standard install snippet into the HTML field, with your workspace ID filled in:
<script>
(function (w, d, id, jq, c) {
w.esat_config = { application_id: id, collection: c || {} };
w.Esat = w.Esat || {};
w.Esat.updateMetadata = function (q, m) {
w.esat_config.collection[q] = w.esat_config.collection[q] || {};
w.esat_config.collection[q].metadata = m;
};
var l = function () {
var r = d.getElementsByTagName('script')[0], s = d.createElement('script');
s.async = true;
s.src = 'https://collection.e-satisfaction.com/dist/js/integration' + (jq ? '.jq' : '') + '.min.js';
r.parentNode.insertBefore(s, r);
};
'complete' === d.readyState ? l() : w.addEventListener('load', l, false);
})(window, document, 'YOUR-WORKSPACE-ID', false, {});
</script>
Fire it on All Pages
Set the tag's trigger to All Pages so collection loads everywhere on your site.
Save the tag
Give the tag a clear name like e-satisfaction collection and save it.
Where's my workspace ID?
Grab the workspace ID from the Code dialog on the Web integration page in the dashboard, then drop it into the snippet in place of YOUR-WORKSPACE-ID.
Push metadata with a second tag
To tag responses with context — like an order ID or the respondent's email — add a second Custom HTML tag that calls Esat.updateMetadata. The trick with GTM is to feed the values in using GTM variables, written as {{like_this}}, so each page fills in real data.
For example, a tag that runs on your purchase confirmation page might look like this:
<script>
Esat.updateMetadata('YOUR-QUESTIONNAIRE-ID', {
responder: {
email: '{{customer_email}}'
},
questionnaire: {
transaction_id: '{{order_id}}',
transaction_date: '{{order_date}}'
}
});
</script>
Fire this tag on the relevant trigger — a purchase or checkout page view, or a dataLayer event like purchase. The responder block holds facts about the person; the questionnaire block holds facts about the transaction. See Pushing metadata for the full breakdown of both.
Define your fields first
Metadata only sticks if the field names you push already exist in the dashboard. Define them under Admin → Data & AI first, then make sure the names in your GTM tag match exactly — they're case-sensitive.
Preview and publish
Open Preview
Use GTM's Preview mode to load your site with the new tags active. Confirm the install tag fires on every page and the collection script loads.
Check the metadata tag
Walk through a purchase or trigger the relevant event, then confirm the metadata tag fires once and the GTM variables resolved to real values.
Publish
Once everything checks out in Preview, Submit and Publish your container to push it live.
Gotchas to watch for
A few things trip people up with the GTM approach:
- Fire order matters. The metadata tag calls
Esat.updateMetadata, which the install snippet defines. Make sure the install tag has had a chance to run — keeping it on All Pages and firing metadata on a later page view or event keeps the order safe. - Only fire once. Set your metadata tag to fire once per page (or per event), so you don't push the same values repeatedly.
- Match the questionnaire ID. The questionnaire ID in
updateMetadatais case-sensitive — copy it exactly from the dashboard.
Related articles
Install on your website
Prefer pasting the snippet directly? Here's the standard head-snippet install.
Pushing metadata
What responder and questionnaire metadata are, and how they power targeting.
E-commerce
Wire collection into your store and push order details with each response.
Web integration
Set the widget type, position, and display rules from the dashboard.