דלג לתוכן הראשי

Web SDK: מעקב UTM ושיוך קמפיינים

עמוד זה מכסה מעקב UTM ושיוך קמפיינים ב־Joryio Web SDK. להתקנה, תצורה ותיעוד ה־API המלא, ראו את מדריך Web SDK.

ה־SDK לוכד אוטומטית פרמטרי UTM מתוך ה־URL לשיוך קמפיינים וניתוח שיווקי. כך אפשר לעקוב אחרי קמפיינים שמייצרים המרות ולנתח משפכים.

לכידת UTM אוטומטית

ברירת מחדל: ה־SDK לוכד את כל פרמטרי ה־UTM הסטנדרטיים כאשר הם קיימים ב־URL:

  • utm_source - מקור הקמפיין (לדוגמה, "google", "newsletter")
  • utm_medium - אמצעי שיווקי (לדוגמה, "email", "cpc", "social")
  • utm_campaign - שם הקמפיין (לדוגמה, "summer_sale", "product_launch")
  • utm_content - תוכן מודעה או וריאנט (לדוגמה, "banner_v1", "link_in_bio")
  • utm_term - מילות חיפוש ממומנות (לדוגמה, "running+shoes")

נלכדים גם:

  • referrer - מפנה HTTP (לדוגמה, "https://google.com")
  • landing_page - כתובת נחיתה מלאה עם פרמטרים
// Example URL:
// https://example.com/pricing?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale

// All events will automatically include:
{
utm_source: "google",
utm_medium: "cpc",
utm_campaign: "spring_sale",
referrer: "https://google.com/search?q=...",
landing_page: "https://example.com/pricing?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale"
}

שיוך First Touch ו־Last Touch

ה־SDK עוקב אחר first touch (שיוך לכל החיים) ו־last touch (שיוך אחרון):

First Touch - נלכד בביקור הראשון ואינו נכתב מחדש:

first_touch_utm_source: "facebook"
first_touch_utm_medium: "social"
first_touch_utm_campaign: "awareness_campaign"
first_touch_landing_page: "https://example.com/?utm_source=facebook..."
first_touch_captured_at: "2024-01-15T10:30:00Z"

Last Touch - מתעדכן בכל פעם שמזוהים פרמטרי UTM חדשים:

last_touch_utm_source: "google"
last_touch_utm_medium: "cpc"
last_touch_utm_campaign: "conversion_campaign"
last_touch_landing_page: "https://example.com/pricing?utm_source=google..."
last_touch_captured_at: "2024-02-20T15:45:00Z"

המודל הדואלי עוזר לענות על:

  • First Touch: "מאיפה המשתמש הגיע לראשונה?"
  • Last Touch: "מה היה המגע האחרון לפני ההמרה?"

אפשרויות תצורה

const joryio = new JoryioSDK({
sdkKey: 'jry_sdk_web_...',

// UTM tracking is enabled by default
captureUTM: true,

// Start new session when campaign changes
resetSessionOnNewCampaign: false,

});

פרטי תצורה:

  • captureUTM (ברירת מחדל: true) - לכידה אוטומטית של פרמטרי UTM
  • resetSessionOnNewCampaign (ברירת מחדל: false) - התחלת סשן חדש כאשר UTM משתנים (בדומה ל־Amplitude)
  • referrer ו־landing page מתווספים למאפייני האירוע כברירת מחדל.

מעקב UTM ברמת סשן

פרמטרי UTM נשמרים ברמת הסשן, כך שתוכלו לנתח את מסע המשתמש כולו:

// User arrives from Google Ads campaign
// URL: ?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale

// First event in session
joryio.track('Page Viewed', { page: '/landing' });
// Includes: utm_source, utm_medium, utm_campaign, referrer, landing_page

// User navigates to pricing (no UTM in URL)
joryio.track('Page Viewed', { page: '/pricing' });
// Still includes: utm_source="google", utm_medium="cpc", utm_campaign="spring_sale"

// All events in this session will carry the campaign attribution
joryio.track('Trial Started');
// Includes: utm_source="google", utm_medium="cpc", utm_campaign="spring_sale"

איפוס סשן בקמפיין חדש

הפעילו resetSessionOnNewCampaign כדי להתחיל סשן חדש כשהמשתמש מגיע מקמפיין אחר:

const joryio = new JoryioSDK({
sdkKey: 'jry_sdk_web_...',
resetSessionOnNewCampaign: true,
});

// Session 1: User from Facebook
// URL: ?utm_source=facebook&utm_medium=social
// session_id: "sess_123"

// Session 2: Same user returns from Google (new session starts)
// URL: ?utm_source=google&utm_medium=cpc
// session_id: "sess_456" (new session ID)

שימושי עבור:

  • אנליטיקה מדויקת ברמת קמפיין
  • מניעת בלבול בשיוך כאשר משתמש מגיע מכמה קמפיינים
  • ניתוח התנהגות לפי קמפיין

עדכוני UTM ידניים (SPA)

עבור אפליקציות חד־עמודיות שמשנות URL ללא רענון:

// When URL changes in your SPA
window.addEventListener('popstate', () => {
joryio.updateUTM();
});

// Or in your router
router.on('route-change', () => {
joryio.updateUTM();
});

// React Router example
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

function App() {
const location = useLocation();

useEffect(() => {
// Update UTM on route change
joryio.updateUTM();
}, [location]);
}

גישה לנתוני UTM

קבלו נתוני UTM נוכחיים באופן תכנותי:

// Get all UTM data
const utmData = joryio.getUTMData();

console.log(utmData);
// {
// current: {
// utm_source: "google",
// utm_medium: "cpc",
// utm_campaign: "spring_sale",
// referrer: "https://google.com",
// landing_page: "https://example.com/?utm_source=google...",
// captured_at: 1705319400000
// },
// firstTouch: {
// utm_source: "facebook",
// utm_medium: "social",
// utm_campaign: "awareness",
// captured_at: 1704715200000
// },
// lastTouch: {
// utm_source: "google",
// utm_medium: "cpc",
// utm_campaign: "spring_sale",
// captured_at: 1705319400000
// }
// }

// Use in your application
const { current, firstTouch, lastTouch } = joryio.getUTMData();

if (current?.utm_source === 'google') {
// Show special offer for Google traffic
}

מקרי שימוש

1. ניתוח ביצועי קמפיינים

// Track conversions with full attribution
joryio.track('Order Completed', {
order_id: 'order_123',
revenue: 99.99
});
// Automatically includes UTM parameters for attribution

2. בדיקות A/B לגרסאות קמפיין

// Track which ad creative drives conversions
// URL: ?utm_content=banner_v1
joryio.track('Signup Completed');
// Can analyze: which utm_content value has highest conversion rate

3. שיוך מרובה נקודות מגע

// See the full user journey
const { firstTouch, lastTouch } = joryio.getUTMData();

joryio.track('Purchase', {
order_value: 299.99,
// First touch: where they came from originally
discovered_via: firstTouch?.utm_source,
// Last touch: what drove the final conversion
converted_via: lastTouch?.utm_source
});

4. ניתוח משפך

// Analyze drop-off by campaign
joryio.track('Checkout Started'); // Auto-includes UTM
joryio.track('Payment Info Added'); // Same UTM
joryio.track('Order Completed'); // Same UTM

// Now you can segment funnel by utm_campaign to see which campaigns
// have the best conversion rates through each step

שיקולי פרטיות

פרמטרי UTM ומידע referrer נשמרים ב־localStorage ומנוקים כאשר:

  • המשתמש קורא joryio.reset() (התנתקות)
  • המשתמש מנקה נתוני דפדפן

שיוך first touch ו־last touch נשמר בין סשנים עבור אותו משתמש עד ניקוי נתונים או התנתקות - ל־localStorage אין תפוגה מובנית.