Google Analytics (especially GA4) automatically identifies the traffic source of a visitor based on UTM parameters
When a user lands on your website, GA stores their source in the browser session. When they submit a Dynamics 365 Marketing form embedded on your site, the browser fires the “form submit event” -> GA ties that event back to that same session -> so you know the exact source.
1. A visitor lands on your website, Examples:
Comes from Google -> Organic Search
Comes from Facebook -> Social
Comes from Google Ads -> Paid Search
Comes from Email campaign -> Email
GA automatically tags that session with the appropriate source/medium.
If UTMs are used:
?utm_source=linkedin&utm_medium=social&utm_campaign=leadgen
2. Visitor fills out a Dynamics 365 Marketing form
You embed the D365 Marketing form inline on your webpage. The form script loads inside your page, so GA can track any event you fire from the browser.
Use the D365 Marketing “onSuccess” callback to send an event to GA , When the form is submitted successfully, this callback runs:
msdynmkt.onFormSubmitSuccess(function() {
gtag('event', 'lead_form_submit', {
event_category: 'D365 Marketing',
event_label: 'Lead Form'
});
});
This fires a GA Event named lead_form_submit.
3. GA records the event and automatically associates it with the session source
GA uses the visitor’s session data to tell you where the lead came from, such as:
Organic Search (Google/Bing)
Paid Search (Google Ads)
Social (Facebook, LinkedIn, Instagram)
Email (your email campaigns)
Referral (another website)
Direct (typed the URL manually)
You convert your custom event (lead_form_submit) into a Conversion.
Now GA will show:
|
Conversion
|
Source
|
Medium
|
Count
|
|
Lead Form Submit
|
google
|
organic
|
55
|
|
Lead Form Submit
|
linkedin
|
social
|
20
|
|
Lead Form Submit
|
newsletter
|
email
|
18
|
|
Lead Form Submit
|
google
|
cpc
|
12
|
This tells you exactly where your D365 leads came from.
Regards,
Manoj
✅If this answer helped you, please consider marking it as Verified, it really helps others in community