Add User Data Script
This article explains how to add the AdPage User Data Script to a custom website or CMS. This script collects marketing and device data. It also pushes the trytagging_user_data event to the dataLayer.
When should you use this script?
Custom CMS without the AdPage plugin
✅ Yes
Custom-built website
✅ Yes
Platform without an AdPage integration
✅ Yes
Shopify with the AdPage App
❌ No
WooCommerce with the AdPage Plugin
❌ No
WordPress with the AdPage Plugin
❌ No
Magento with the AdPage Extension
❌ No
Lightspeed with the AdPage Pixel
❌ No
What does this script do?
The User Data Script automatically collects:
Device information: Browser, operating system, and screen resolution.
Marketing data: UTM parameters, referrers, campaign data, and session IDs.
User identification: Client ID, session ID, and session count for accurate attribution.
This data becomes available in the dataLayer through trytagging_user_data. This event starts all other tracking. Without it, tracking data is not processed correctly.
Why is the load order important?
The trytagging_user_data event contains key identifiers. These include client_id, session_id, and session_count. All following events use them. Problems occur if other dataLayer events, such as view_item or add_to_cart, are pushed before this script loads:
Google Tag misses required configuration parameters.
Sessions cannot be attributed correctly.
Webhooks do not work correctly because marketing data is missing.
GA4 and advertising platforms receive incomplete data, or no data.
Step 1: Find your linked domain
Before installing the script, you need your linked domain. You can find it in two ways.
Option A: Use the installation link
If you received an installation link from AdPage, the instructions include the domain.
Option B: Use the Trytagging dashboard
Go to the adpage platform and sign in.
Select the correct container.
Go to Implementation → Domain name.
Copy your linked domain, for example
tagging.yourwebsite.com.
Step 2: Install the script via Google Tag Manager (optional)
To manage the script through Google Tag Manager instead of your source code:
Create a Custom HTML Tag in GTM.
Paste the complete script, including the
<script>tags.Set the trigger to All Pages or DOM Ready.
Ensure this tag fires first. Use Tag Sequencing if needed.
Tag setup


Copy the following script. Replace [YOUR_LINKED_DOMAIN] with the linked domain from Step 1.
Example with a linked domain
If your linked domain is tagging.webshop.nl, replace line 42:
Step 3: Verify the installation
After adding the script, verify that it works correctly.
Check 1: Browser console
Open your website in Chrome or Firefox.
Open Developer Tools with
F12orCmd+Option+I.Select the Console tab.
Confirm there are no red errors related to
taggingoruser-data.
Check 2: Verify the dataLayer
Enter
dataLayerin the console.Press Enter.
Find an object with
event: "trytagging_user_data".Confirm the
marketinganddeviceobjects contain data.
Example of correct output:
Check 3: Network tab
Select the Network tab in Developer Tools.
Refresh the page.
Filter for
user-data.Confirm
user-data-minified.jsloaded successfully with status200.
Troubleshooting
The script does not load
Possible causes:
The domain name is incorrect.
The linked domain is not active in Trytagging.
The URL contains a typo.
Resolution:
Confirm that you copied the correct domain from Trytagging.
Test
https://[your-domain]/user-data-minified.jsdirectly in your browser.Contact AdPage support if you receive a
404error.
No data in the dataLayer
Possible causes:
The script appears after other tracking scripts.
A JavaScript error occurs on the page.
An ad blocker blocks the script.
Resolution:
Move the script to the start of the
<head>section.Check the console for JavaScript errors.
Test in an incognito window without extensions.
taggingHelpers is undefined
Possible causes:
The external script has not loaded yet.
A network problem occurred.
Resolution: The script waits up to 10 seconds for loading. If the issue continues, check:
Whether the URL is correct.
Whether the console shows CORS errors.
Whether a firewall blocks the script.
Console error: Timeout waiting for taggingHelpers
This means the script was still unavailable after 10 seconds.
Resolution:
Check your internet connection.
Confirm that the script URL is reachable.
Increase the timeout value if needed:
timeout = timeout || 10000;on line 11.
Frequently asked questions
Can I combine this with the full custom dataLayer?
Yes. This script only provides the trytagging_user_data event.
Do I need to add the script to every page?
Yes. The script must appear on every page of your website. Push trytagging_user_data on every page before other tracking events occur.
Does this script work with Consent Mode?
Yes. The script supports Google Consent Mode. When you use a CMP, data is collected only after the visitor gives consent.
Do I need this script for Data Assistant?
Yes. The Data Assistant Tag requires trytagging_user_data as its start event. Without this script, Data Assistant does not work correctly.
What if I have multiple domains?
Each domain needs a separate linked domain in Trytagging. Update the script for each domain with the correct URL.
Last updated
Was this helpful?

