Legacy GTM Setup (Pre-v3.0)
The information below is preserved for sites still using GTM-based CTA tracking. For new installations, use the WordPress plugin instead.Google Tag Manager (GTM) captures CTA view and click events on your website, sending them to WisePilot for attribution tracking. With plugin v3.0+, this is handled natively by the attribution tracker script.
Prerequisites
- Google Tag Manager account with a container deployed to your website
- Attribution script already deployed on your site
- Access to your GTM workspace to create tags and triggers
What GTM Did in the Pipeline
Step 1: Create CTA View Event Tag
This tag fires when a CTA becomes visible on the page.- In GTM, create a new Custom HTML tag
- Set the trigger to a Custom Event named
cta_view - Add this HTML:
Replace the
{{...}} template variables with actual GTM variables that pull from your CTA data attributes (data-cta-id, data-cta-position, data-asset-content-id).Step 2: Create CTA Click Event Tag
This tag fires when a user clicks a CTA element.- Create a new Custom HTML tag
- Set the trigger to click events on elements with
[data-cta-id]or the.cr-ctaclass - Add this HTML:
Migrating Away from GTM
To migrate to plugin-native tracking:- Install the WisePilot WordPress plugin v3.0+
- Verify events are arriving in WisePilot (check Network tab for
/api/integrations/cr/events) - Once confirmed, remove your GTM CTA view and click tags
- Keep GTM for other tracking needs (GA4 config, conversion tags, etc.)
ingest_source: 'gtm') are preserved alongside new plugin events (ingest_source: 'cr_plugin').
Troubleshooting
Events not arriving in WisePilot
- Check GTM container is deployed — View your page source and verify the GTM snippet is present
- Check browser console — Look for JavaScript errors that might prevent tags from firing
- Check network tab — If using server-side, verify requests to
/api/integrations/gtm/eventsare succeeding (200 status) - Check ad blockers — Some ad blockers prevent GTM from loading. Test in an incognito window with extensions disabled.
Events arrive but attribution_id is null
- Verify attribution script loads before GTM — The script must set the cookie before GTM reads it
- Check
window.getAttributionId()— Open the console and call this function. If it returnsnull, the attribution script isn’t running. - Check cookies — Look for
cr_attribin Application -> Cookies. If missing, the attribution script may be blocked.
Events arrive but CTA fields are empty
- Verify your CTA elements have the required data attributes:
data-cta-id,data-cta-position,data-asset-content-id - Check that your GTM variables are correctly reading from these attributes
- Test with the GTM Preview panel to see what values the variables resolve to