Skip to Content
The Makinari API repo now includes an MCP Server — connect your AI models directly. View on GitHub →

Tracking Methods

setConsent()

Sets user consent for tracking and cookie usage.

Syntax

window.MarketFit.setConsent(consentType, granted)

Parameters

  • consentType string (required): Consent type (‘analytics’, ‘marketing’, ‘functional’)
  • granted boolean (required): If consent was granted

Example

// Grant consent for analytics window.MarketFit.setConsent('analytics', true); // Revoke consent for marketing window.MarketFit.setConsent('marketing', false);

trackEvent()

Records custom events for analysis and tracking.

Syntax

window.MarketFit.trackEvent(eventName, properties)

Parameters

  • eventName string (required): Name of the event to record
  • properties object (optional): Additional event properties

Example

// Record interaction event window.MarketFit.trackEvent('button_click', { button_name: 'pricing_cta', page: '/pricing', user_type: 'visitor' }); // Record conversion event window.MarketFit.trackEvent('conversion', { type: 'lead_generation', value: 100, campaign: 'summer_promo' });

trackPageView()

Records a page view for navigation tracking.

Syntax

window.MarketFit.trackPageView(pageData)

Parameters

  • pageData object (optional): Additional page data

Example

// Record basic page view window.MarketFit.trackPageView(); // With additional data window.MarketFit.trackPageView({ page_title: 'Pricing Page', page_category: 'commercial', user_segment: 'enterprise' });

Object handling user consent for cookies and tracking.

Properties

const consent = window.MarketFit.consent; // Available properties consent.consentGranted // boolean: general consent consent.categories // object: consent categories consent.forceShow // boolean: force show banner

Example

// Verify consent state console.log('Consent granted:', window.MarketFit.consent.consentGranted); console.log('Categories:', window.MarketFit.consent.categories);
Last updated on