Setting Up Goals and Conversions in Google Analytics
GA4 doesn't have "Goals" in the classical UA sense. Instead — events marked as key (Conversions). Each event with a "conversion" toggle appears in conversion reports and participates in attribution. The task — properly design events, mark them, and verify data transmission.
GA4 Conversion Architecture
Conversion in GA4 = event with parameter, marked in interface as conversion. Standard flow:
User → action on site
→ GA4 registers event (via gtag.js or GTM)
→ GA4 Admin → Events → mark "Mark as conversion"
→ Event appears in Conversions reports
GA4 counts multiple conversions of the same event within one session. To count only the first — need additional parameter or report filtering.
Basic Conversion Event Markup
// Send conversion via gtag.js
// gtag must be initialized with your Measurement ID
// Conversion: form submission
gtag('event', 'generate_lead', {
event_category: 'lead',
event_label: 'contact_form',
value: 1,
currency: 'RUB',
form_name: 'main_contact',
page_section: 'footer',
});
// Conversion: purchase
gtag('event', 'purchase', {
transaction_id: 'ORDER-789',
affiliation: 'Web',
value: 14500,
tax: 500,
shipping: 300,
currency: 'RUB',
coupon: '',
items: [{
item_id: 'SKU-001',
item_name: 'Professional Plan',
item_category: 'subscription',
price: 13700,
quantity: 1,
}],
});
// Conversion: registration
gtag('event', 'sign_up', {
method: 'email',
});
// Conversion: begin checkout
gtag('event', 'begin_checkout', {
currency: 'RUB',
value: 14500,
items: [{ item_id: 'SKU-001', item_name: 'Pro Plan', price: 14500, quantity: 1 }],
});
Custom Conversions via GTM
If site uses GTM, conversions are set up without code changes:
1. Create Trigger:
- Type: "Form Submission" or "Click — All Elements"
- Condition:
Click Text contains "Submit"orPage URL contains /thank-you
2. Create Tag:
- Type: "Google Analytics: GA4 Event"
- Event Name:
generate_lead - Event Parameters:
-
form_name→{{Form ID}} -
page_path→{{Page Path}}
-
3. Check via Preview: GTM Preview + DebugView in GA4 — all events should appear in real-time.
Data Layer for GTM
For passing dynamic data (user ID, order sum) from code to GTM:
// Initialize dataLayer
window.dataLayer = window.dataLayer || [];
// Pass data before event
window.dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: orderId,
value: totalAmount,
tax: taxAmount,
shipping: shippingCost,
currency: 'RUB',
items: cartItems.map(item => ({
item_id: item.sku,
item_name: item.name,
item_category: item.category,
price: item.price,
quantity: item.qty,
})),
},
user_id: currentUser?.id ?? undefined,
});
// Clear ecommerce object before next event (required for GA4)
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push({
event: 'view_item',
ecommerce: { /* ... */ },
});
Configuration in GA4 Interface
After events start arriving:
- Admin → Events — list of all events for last 30 days
- Find needed event (e.g.,
generate_lead) - Toggle "Mark as conversion" → On
- Event appears in Reports → Conversions within 24–48 hours (not real-time)
For immediate check: DebugView (Admin → DebugView) shows events in real-time with parameters.
Custom Parameters and Dimensions
Event parameters don't display in GA4 reports by default — must be registered:
-
Admin → Custom Definitions → Create Custom Dimension
- Dimension name:
form_name - Scope: Event
- Event parameter:
form_name
- Dimension name:
-
After registration, parameter becomes available in reports and Explorations
Limit: 50 custom event dimensions per property (in free GA4).
Conversion Attribution
GA4 uses Data-Driven Attribution by default (if sufficient data) or Last Click. Change model:
Admin → Attribution Settings → Reporting attribution model
Available models:
- Data-driven (recommended for >1000 conversions/month)
- Last click
- First click
- Linear
- Time decay
Lookback window (attribution window) for different conversion types configured separately: up to 90 days for purchase, up to 30 days for generate_lead.
Conversions in Ad Campaigns
To import conversions into Google Ads:
- Google Ads → "Conversions" → "Import from GA4"
- Select needed conversions
- Set conversion value (if not passed in event)
After GA4 ↔ Google Ads linking, conversions used in "Target CPC" and "Maximize conversions" strategies.
Conversion Report with Segmentation
In Explorations you can build arbitrary reports. Example — conversions by traffic source:
Explorations → Blank →
Rows: Session source / medium
Values: Conversions (event: generate_lead), Conversion rate
Segment: Converted users
This gives table: Google CPC → 45 conversions, 3.2%; Organic → 28 conversions, 1.8%.
Debugging
// In DevTools Console — check GA4 initialized
window.dataLayer // should be array
window.gtag // should be function
// View all events in dataLayer
window.dataLayer.filter(e => e.event).map(e => e.event)
// Enable debug_mode for one page
gtag('config', 'G-XXXXXXXX', { debug_mode: true });
// After this, events visible in DebugView GA4
Chrome Extension "GA Debugger" or "Tag Assistant" shows all hits in panel.
Timeline
Marking 3–5 key conversions in code + GTM tags — 1 day. Setting custom parameters and Data Layer — 4–6 hours. Attribution setup and Google Ads linking — 2–3 hours.







