Skip to main content

UTM Tracking in MODX

MODX (also called MODX Revolution) is an open-source PHP content management framework. Unlike builders such as Wix or Duda, it gives you full control over your template and form markup, similar to Webflow, so UTMSimple's standard installation works without any platform-specific workarounds.

1. Add the tracking script to your Template

In the MODX Manager, open Elements in the left sidebar and edit the Template used by the pages you want to track (or the header Chunk it includes). Paste the tracking script from Where is the tracking code? just before the closing </head> tag:

<!-- Global site UTM Simple Tracking Start-->
<script>
var handl_custom_params=[];
var handl_js = document.createElement("script");
handl_js.setAttribute("src", "https://track.utmsimple.com/utm.js?license=<License Key>");
document.head.appendChild(handl_js);
</script>
<!--Global site UTM Simple Tracking End -->

Replace <License Key> with the key from your UTMSimple account. Because templates are shared across resources, adding the script once covers every page built on that template.

2. Track UTMs in your forms

MODX doesn't ship its own form builder, most sites use the FormIt extra or a plain HTML <form>. Either way you have full control over field markup, so just name, ID, or class your fields using UTMSimple's naming convention and they'll be auto-filled, no extra JavaScript required:

<input type="hidden" name="utm_source" />
<input type="hidden" name="utm_medium" />
<input type="hidden" name="utm_campaign" />
<input type="hidden" name="utm_term" />
<input type="hidden" name="utm_content" />

See What can I track with UTMSimple? for the full list of parameters you can capture, including custom ones.

3. Verify it's working

Load any page on your site with UTM parameters in the URL (e.g. ?utm_source=test&utm_medium=test&utm_campaign=test) and inspect your form, the hidden fields should fill in automatically. See How do I know If I'm tracking? for other ways to confirm it.


If your MODX setup is different (for example, a form plugin that won't let you set field names), let us know via chat and we would be happy to assist you.