Skip to main content
pagent can push test assignments and conversions into your own tag manager. From there you can send them to GA4, your ad platforms or your data warehouse with the tags you already have. No code is needed on your site.

Set it up

  1. In pagent, open Integrations and click Configure on the Tag Managers card.
  2. Under Destinations, turn on one or more:
    • Google Tag Manager pushes to window.dataLayer. If your container uses a different array, change dataLayer name.
    • JENTIS pushes to the JENTIS tag (_jts) once it has loaded. Events fired before that are queued for up to 30 seconds.
    • Custom dataLayer pushes into any named window array, for Tealium, Adobe Launch, Piwik PRO or your own. Enter the Array name.
  3. Optionally change the Field prefix (default pagent_). It is prepended to every event name and field.
  4. Under Forwarded events, choose what to send. See below.
  5. Save. Your site picks up the change within a minute.
To check it, open GTM Preview on your site and look for the pagent_assignment event on page load.

Forwarded events

Raw analytics (clicks, scrolls, hovers) is never forwarded. Visitors who opted out of pagent are never forwarded. Anything else, including what your tags do with the data, follows your tag manager’s own consent setup.

Test assignment

Assignment is pushed again on every page view, because tag managers start a fresh data model on each page load. That way your own tags always have the test context available as dataLayer variables.
A visitor in two tests gets two assignment pushes. pagent_experiments and pagent_tests list all of them in both pushes; pagent_tests joins them with |.

Conversions

All conversions share the pagent_conversion event name, with the goal in a field. That way renaming a goal never breaks a GTM trigger.
Forwarded conversions are the ones the SDK records in the browser: click goals, page view goals and deprecated programmatic conversions. Event goals are not forwarded, because pagent computes them from your events after the fact. Events observed from your dataLayer are already in your tag manager. For events you send with window._pgnt.push, push the same event to your dataLayer as well, or forward it from the pagent:event listener.

Using it in GTM

A typical GA4 setup:
  1. Create Data Layer Variables for pagent_experiment_id, pagent_variation_id and pagent_test.
  2. Create a Custom Event trigger on pagent_assignment.
  3. Add a GA4 Event tag, for example experience_impression, that sends pagent_test as a parameter and fires on that trigger.
Everything pagent pushes carries _pagent_forwarded: true. pagent ignores those entries when it observes your dataLayer, so forwarded conversions are never counted a second time as events.

Before forwarding existed

Earlier integrations forwarded data with a hand-written pagent:event listener, as in the JENTIS example. That still works. If you switch to forwarding, remove the listener so events are not sent twice.