WP Mautic
Mautic WordPress Plugin injects Mautic tracking script and image in the WP website. Your Mautic instance will be able to track information about your visitors. You can also insert Mautic content inside your website using different shortcodes. Key features You don’t have to edit source code of your t
Mautic WordPress Plugin injects Mautic tracking script and image in the WP website. Your Mautic instance will be able to track information about your visitors. You can also insert Mautic content inside your website using different shortcodes.
Key features
- You don’t have to edit source code of your template to insert tracking code.
- Plugin adds additional information to tracking image URL so you get better results than using just plain HTML code of tracking image.
- You can use Mautic form embed with shortcode described below.
- You can choose where the script is injected (header / footer).
- Tracking image can be used as fallback when JavaScript is disabled.
Configuration
Once installed, the plugin must appared in your plugin list :
- 01Enable it.
- 02Go to the settings page and set your Mautic instance URL.
And that’s it !
Usage
Mautic Tracking Script
Tracking script works right after you finish the configuration steps. That means it will insert the mtc.js script from your Mautic instance. You can check HTML source code (CTRL + U) of your WP website to make sure the plugin works. You should be able to find something like this:
<script> (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n; w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t), m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m) })(window,document,'script','http://yourmauticsite.com/mtc.js','mt'); wpmautic_send(); </script>
Custom attributes handling
If you need to send custom attributes within Mautic events, you can use the wpmautic_tracking_attributes filter.
add_filter('wpmautic_tracking_attributes', function($attrs) { $attrs['preferred_locale'] = $customVar; return $attrs; });
The returned attributes will be added to Mautic payload.
Mautic Forms
To load a Mautic Form to your WP post, insert this shortcode to the place you want the form to appear:
[mautic type="form" id="1"]
Replace “1” with the form ID you want to load. To get the ID of the form, go to your Mautic, open the form detail and look at the URL. The ID is right there. For example in this URL: http://yourmautic.com/s/forms/view/3 the ID is 3.