WordPress Integration
Connect your WordPress site for form submissions, page tracking, and user analytics.
WordPress powers over 40% of websites. Here's how to add AdsMAA tracking to your WordPress site.
What Gets Tracked
With our SDK installed on WordPress:
| Content Type | Events Tracked |
|---|---|
| Pages | PageView on every page load |
| Posts | PageView with category/author |
| Contact Forms | Lead event on submission |
| User Registration | CompleteRegistration event |
| Custom Forms | Form submission events |
Installation Methods
Method 1: Plugin (Recommended)
Use the free "Insert Headers and Footers" plugin:
- Install WPCode plugin (formerly Insert Headers and Footers)
- Go to Code Snippets ā Header & Footer
- Paste in the Header section:
****`html
<script src="https://cdn.adsmai.com/sdk/ct.min.js" data-org="YOUR_ORG_ID"></script>****`
- Click Save Changes
Method 2: Theme Edit
Edit your theme's header.php file:
- Go to Appearance ā Theme Editor
- Select header.php
- Find output
</head> - Paste the script BEFORE :output
</head>
****`html
<script src="https://cdn.adsmai.com/sdk/ct.min.js" data-org="YOUR_ORG_ID"></script> </head> ****`- Click Update File
Note: Theme updates may overwrite this. Use a child theme for persistence.
Method 3: functions.php
Add to your theme's functions.php:
****
php function add_adsmai_tracking() { echo '<script src="https://cdn.adsmai.com/sdk/ct.min.js" data-org="YOUR_ORG_ID"></script>'; } add_action('wp_head', 'add_adsmai_tracking'); ****Contact Form Tracking
Contact Form 7
Track form submissions automatically:
****
javascript document.addEventListener('wpcf7mailsent', function(event) { adsmai('track', 'Lead', { formId: event.detail.contactFormId, formName: 'Contact Form 7' }); }); ****Gravity Forms
****
javascript jQuery(document).on('gform_confirmation_loaded', function(event, formId) { adsmai('track', 'Lead', { formId: formId, formName: 'Gravity Form' }); }); ****WPForms
****
javascript document.addEventListener('wpformsAjaxSubmitSuccess', function(event) { adsmai('track', 'Lead', { formId: event.detail.formId, formName: 'WPForm' }); }); ****Universal Form Tracking
Enable auto-tracking for all forms:
****
javascript adsmai('init', 'YOUR_API_KEY', { autoTrack: { forms: true } }); ****WooCommerce Note
If you're running WooCommerce, use our dedicated WooCommerce integration instead:
| Integration | Best For |
|---|---|
| WordPress | Content sites, blogs, lead gen |
| WooCommerce | Online stores, e-commerce |
WooCommerce integration provides:
- Order tracking via webhooks
- Customer data sync
- Full e-commerce funnel tracking
See WooCommerce Integration for setup.
Recap
WordPress integration provides:
- Easy installation via plugin or theme
- Automatic pageviews on all content
- Form tracking for major form plugins
- User identification on registration
Next step: Test your tracking to verify events are flowing.
Key Takeaways
- 1Works with any WordPress theme
- 2Multiple installation options available
- 3Automatic form submission tracking
- 4Compatible with popular plugins
Frequently Asked Questions
Will this work with my theme?
Does this work with caching plugins?
Should I use this or WooCommerce integration?
Was this article helpful?
Continue Reading
WooCommerce Integration
Connect your WooCommerce store with REST API for server-side tracking plus unified SDK for all pixels.
integrationsUnified JavaScript SDK
One SDK for all platforms. Auto-loads Meta Pixel, GA4, and Clarity based on your connected integrations.
integrationsShopify Integration
Connect your Shopify store with webhooks for server-side tracking plus unified SDK for client-side pixels.