### Custom Configuration and Data Retrieval Example Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Shows how to initialize the tracker with custom settings and retrieve specific types of attribution data. This example highlights flexibility in configuration and data access. ```javascript // Initialize with custom settings const tracker = new AttributionTracker({ cookieDuration: 60, useSessionStorage: true, additionalParams: ['affiliate_id', 'custom_source'], storageKey: 'my_attribution_data' }); // Get specific data types const utmData = tracker.getUtmParameters(); const adData = tracker.getAdPlatformParameters(); const referrer = tracker.getReferrer(); ``` -------------------------------- ### Basic Attribution Tracker Usage Example Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Demonstrates the basic initialization and retrieval of all attribution data. This is a common starting point for using the tracker. ```javascript // Initialize tracker const tracker = new AttributionTracker(); // Later, when you need the data const allAttributionData = tracker.getAll(); console.log('Attribution Data:', allAttributionData); ``` -------------------------------- ### Initialize Attribution Tracker Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Include the AttributionTracker class and initialize it when your application loads. This is the basic setup for the tracker. ```javascript const tracker = new AttributionTracker(); ``` -------------------------------- ### Get Landing Page URL Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Returns the full URL of the page where the user first initiated the session. This is useful for analyzing which entry points lead to the most conversions. Returns null if not yet stored. ```javascript const tracker = new AttributionTracker(); const landingPage = tracker.getLandingPage(); console.log(landingPage); // 'https://example.com/products/shoes?utm_source=newsletter&utm_campaign=spring' ``` ```javascript analytics.track('conversion', { landingPage: tracker.getLandingPage(), currentPage: window.location.href, sessionDepth: window.history.length }); ``` -------------------------------- ### Retrieve Initial HTTP Referrer URL Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `getReferrer()` method to get the URL of the page that linked to the current page. ```javascript const referrer = tracker.getReferrer(); ``` -------------------------------- ### Get Referrer URL Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Retrieves the initial HTTP referrer URL captured on the user's first visit. This is valuable for understanding traffic sources and classifying user journeys. Returns null if the user arrived directly. ```javascript const tracker = new AttributionTracker(); const referrer = tracker.getReferrer(); if (referrer) { console.log('User came from:', referrer); // 'https://www.google.com/' // Classify traffic source from referrer domain const referrerDomain = new URL(referrer).hostname; const trafficSource = referrerDomain.includes('google') ? 'organic_search' : referrerDomain.includes('facebook') ? 'social' : 'referral'; console.log('Traffic source:', trafficSource); // 'organic_search' } else { console.log('Direct traffic — no referrer available.'); } ``` -------------------------------- ### Get Attribution Timestamp Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Returns the ISO 8601 timestamp of when attribution data was first captured. This is useful for calculating time-to-conversion and filtering stale attribution data. ```javascript const tracker = new AttributionTracker(); const timestamp = tracker.getTimestamp(); console.log(timestamp); // '2024-06-01T10:23:45.123Z' ``` ```javascript if (timestamp) { const firstTouch = new Date(timestamp); const now = new Date(); const hoursElapsed = (now - firstTouch) / (1000 * 60 * 60); console.log(`Hours since first attribution: ${hoursElapsed.toFixed(1)}`); // 'Hours since first attribution: 3.7' // Discard attribution older than 7 days on conversion if (hoursElapsed > 7 * 24) { console.warn('Attribution data is stale (> 7 days). Consider clearing.'); tracker.clear(); } } ``` -------------------------------- ### Integrate with Cookie Consent Management Platforms Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Modify the `checkCookieConsent()` method to integrate with your specific Consent Management Platform (CMP). Examples for OneTrust, Cookiebot, and custom functions are provided. ```javascript // OneTrust example checkCookieConsent() { return OnetrustActiveGroups.includes('C0002'); } // Cookiebot example checkCookieConsent() { return Cookiebot.consent.marketing; } // Custom implementation checkCookieConsent() { return yourConsentFunction(); } ``` -------------------------------- ### Retrieve Attribution Data Capture Timestamp Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `getTimestamp()` method to get the date and time when the attribution data was initially captured. ```javascript const timestamp = tracker.getTimestamp(); ``` -------------------------------- ### Get Ad Platform Parameters Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Retrieves ad platform-specific click and tracking IDs. Useful for attributing conversions to specific ad campaigns across platforms like Google, Facebook, and Twitter. Returns an empty object if no parameters are found. ```javascript const tracker = new AttributionTracker(); const adParams = tracker.getAdPlatformParameters(); console.log(adParams); // { gclid: 'EAIaIQobChMI...', gad_source: '1' } ``` ```javascript function recordConversion(orderId, revenue) { const adData = tracker.getAdPlatformParameters(); const payload = { orderId, revenue, adClickData: adData }; if (adData.gclid) { // Send to Google Ads conversion endpoint gtag('event', 'conversion', { 'send_to': 'AW-XXXXXXXX/YYYY', value: revenue, currency: 'USD', transaction_id: orderId }); } if (adData.fbclid) { // Send to Meta Pixel fbq('track', 'Purchase', { value: revenue, currency: 'USD', order_id: orderId }); } console.log('Conversion recorded with ad attribution:', payload); } ``` -------------------------------- ### Retrieve UTM Parameters Only Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Get only the standard UTM parameters (`utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`). Returns an empty object if none are captured. Ideal for sending campaign-level data to analytics. ```javascript const tracker = new AttributionTracker(); const utm = tracker.getUtmParameters(); console.log(utm); fetch('/api/track', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ event: 'page_view', utm: tracker.getUtmParameters(), page: window.location.pathname }) }); ``` -------------------------------- ### Clear Attribution Data After Conversion Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Call `clear()` after a successful conversion event to prevent the same attribution from being credited to future purchases. This example shows clearing data only after a successful order submission. ```javascript const tracker = new AttributionTracker({ storageKey: 'attribution_data' }); // E-commerce: attach attribution to order, then clear it async function submitOrder(cartItems) { const orderPayload = { items: cartItems, attribution: tracker.getAll(), // Capture before clearing total: cartItems.reduce((sum, i) => sum + i.price, 0) }; try { const response = await fetch('/api/orders', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(orderPayload) }); if (response.ok) { tracker.clear(); // Only clear after successful submission console.log('Order submitted and attribution cleared.'); } } catch (err) { console.error('Order failed — attribution data preserved for retry:', err); // tracker.clear() NOT called — data is retained for retry } } ``` -------------------------------- ### Retrieve All Attribution Data Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Get the complete stored attribution object, including UTM parameters, ad platform IDs, referrer, landing page, and timestamp. Returns null if no data is stored. Useful for attaching data to forms or API calls. ```javascript const tracker = new AttributionTracker(); const attribution = tracker.getAll(); if (attribution) { console.log(attribution); document.getElementById('checkout-form').addEventListener('submit', (e) => { const hiddenInput = document.createElement('input'); hiddenInput.type = 'hidden'; hiddenInput.name = 'attribution'; hiddenInput.value = JSON.stringify(attribution); e.target.appendChild(hiddenInput); }); } else { console.log('No attribution data — direct traffic or no tracked parameters present.'); } ``` -------------------------------- ### Configure Attribution Tracker Options Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Initialize the tracker with a configuration object to customize its behavior. Options include cookie duration, storage type, additional parameters, and storage key. ```javascript const tracker = new AttributionTracker({ cookieDuration: 30, // Number of days to store data (default: 30) useSessionStorage: false, // Use sessionStorage instead of cookies (default: false) additionalParams: [], // Array of additional URL parameters to track storageKey: 'attribution_data' // Key used for storage (default: 'attribution_data') }); ``` -------------------------------- ### Constructor: new AttributionTracker(config) Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Initializes the tracker and captures attribution parameters from the current URL. Supports configuration for cookie duration, storage backend, additional parameters, and storage key. ```APIDOC ## Constructor: new AttributionTracker(config) ### Description Initializes the tracker and immediately captures any attribution parameters present in the current page URL. Must be instantiated early in the page lifecycle (e.g., in `` or at the top of your main script) to ensure the landing page URL and referrer are recorded accurately before any navigation occurs. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Configuration Options - **cookieDuration** (number) - Optional - Cookie expiration duration in days. Defaults to 30. - **useSessionStorage** (boolean) - Optional - If true, uses `sessionStorage` instead of cookies. Defaults to `false`. - **additionalParams** (array of strings) - Optional - An array of additional URL parameter keys to capture. - **storageKey** (string) - Optional - The key used for storing data in cookies or `sessionStorage`. Defaults to 'attribution_data'. ### Request Example ```javascript // Basic initialization — uses all defaults const tracker = new AttributionTracker(); // Full configuration example const tracker = new AttributionTracker({ cookieDuration: 60, useSessionStorage: false, additionalParams: ['affiliate_id', 'ref', 'promo_code'], storageKey: 'my_attribution' }); ``` ### Response #### Success Response Initializes the tracker and stores attribution data. The stored data typically includes UTM parameters, ad platform IDs, referrer, landing page URL, and a timestamp. ``` -------------------------------- ### Initialize Attribution Tracker Source: https://github.com/jasenf/attribution-tracker.js/blob/main/example.html Initializes the tracker with custom configuration. Use `cookieDuration` to set how long cookies last, `useSessionStorage` to opt for session storage instead of cookies, and `additionalParams` to include custom parameters. ```javascript const tracker = new AttributionTracker({ cookieDuration: 30, useSessionStorage: false, additionalParams: ['ref', 'affiliate'] }); ``` -------------------------------- ### AttributionTracker Initialization Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md How to include and initialize the AttributionTracker class in your project. ```APIDOC ## Initialization Include the AttributionTracker class in your project and initialize it when your application loads. ```javascript const tracker = new AttributionTracker(); ``` ``` -------------------------------- ### E-commerce Order Processing with Attribution Tracker Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Initialize the tracker early and use `getAll()` to retrieve attribution data before enriching order details. Ensure `sendToAnalytics` is implemented to handle the enriched data. ```javascript const tracker = new AttributionTracker(); function processOrder(orderData) { const attributionData = tracker.getAll(); const enrichedOrderData = { ...orderData, attribution: attributionData }; sendToAnalytics(enrichedOrderData); } ``` -------------------------------- ### getLandingPage() Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Retrieves the full URL of the page where the attribution tracking was first initialized. This represents the user's entry point for the session. Returns null if not yet stored. ```APIDOC ## `getLandingPage()` ### Description Returns the full URL (including query string) of the page where attribution tracking was first initialized. This is the entry point of the user's session, which may differ from the current page if the user has navigated within the site. Returns `null` if not yet stored. ### Method `tracker.getLandingPage()` ### Returns - `string | null`: The landing page URL as a string, or `null` if not yet stored. ``` -------------------------------- ### Load Initial Attribution Data Source: https://github.com/jasenf/attribution-tracker.js/blob/main/example.html Calls `showAllData` on page load to display the initial attribution data captured by the tracker. ```javascript showAllData(); ``` -------------------------------- ### getAll() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Retrieves all stored attribution data as an object. ```APIDOC ## `getAll()` Returns all stored attribution data as an object. ```javascript const allData = tracker.getAll(); ``` ``` -------------------------------- ### AttributionTracker Configuration Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Configuration options available when initializing the AttributionTracker. ```APIDOC ## Configuration Options The tracker accepts a configuration object with the following options: ```javascript const tracker = new AttributionTracker({ cookieDuration: 30, // Number of days to store data (default: 30) useSessionStorage: false, // Use sessionStorage instead of cookies (default: false) additionalParams: [], // Array of additional URL parameters to track storageKey: 'attribution_data' // Key used for storage (default: 'attribution_data') }); ``` ### Configuration Details | Option | Type | Default | Description | |--------|------|---------|-------------| | cookieDuration | number | 30 | Number of days before the cookie expires | | useSessionStorage | boolean | false | If true, uses sessionStorage instead of cookies | | additionalParams | string[] | [] | Additional URL parameters to track | | storageKey | string | 'attribution_data' | Key used for cookie or sessionStorage | ``` -------------------------------- ### getLandingPage() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Retrieves the full landing page URL where tracking began. ```APIDOC ## `getLandingPage()` Returns the full landing page URL where tracking began. ```javascript const landingPage = tracker.getLandingPage(); ``` ``` -------------------------------- ### Retrieve All Stored Attribution Data Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `getAll()` method to retrieve all captured attribution data as a single object. This includes UTM parameters, ad platform IDs, referrer, and timestamp. ```javascript const allData = tracker.getAll(); ``` -------------------------------- ### getAll() Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Retrieves the complete stored attribution object, including all captured parameters and metadata. Returns null if no data is found. ```APIDOC ## getAll() ### Description Returns the complete stored attribution object, including UTM parameters, ad platform IDs, referrer, landing page URL, and capture timestamp. Returns `null` if no attribution data has been stored yet. This is the primary method for retrieving data to attach to form submissions, API calls, or analytics events. ### Method GET (conceptual, as it's a method call) ### Endpoint N/A (Instance method) ### Parameters None ### Request Example ```javascript const tracker = new AttributionTracker(); const attribution = tracker.getAll(); if (attribution) { console.log(attribution); // Example output: // { // utm_source: 'facebook', // utm_medium: 'social', // utm_campaign: 'summer_sale', // fbclid: 'IwAR2x...', // referrer: 'https://www.facebook.com/', // landingPage: 'https://example.com/products?utm_source=facebook&utm_medium=social&utm_campaign=summer_sale&fbclid=IwAR2x...', // timestamp: '2024-06-01T10:23:45.123Z' // } // Attach to a form submission document.getElementById('checkout-form').addEventListener('submit', (e) => { const hiddenInput = document.createElement('input'); hiddenInput.type = 'hidden'; hiddenInput.name = 'attribution'; hiddenInput.value = JSON.stringify(attribution); e.target.appendChild(hiddenInput); }); } else { console.log('No attribution data — direct traffic or no tracked parameters present.'); } ``` ### Response #### Success Response (200) - **attribution object** (object) - Contains all captured attribution data including UTM parameters, ad platform IDs, referrer, landing page URL, and timestamp. - **null** - If no attribution data has been stored. #### Response Example ```json { "utm_source": "facebook", "utm_medium": "social", "utm_campaign": "summer_sale", "fbclid": "IwAR2x...", "referrer": "https://www.facebook.com/", "landingPage": "https://example.com/products?utm_source=facebook&utm_medium=social&utm_campaign=summer_sale&fbclid=IwAR2x...", "timestamp": "2024-06-01T10:23:45.123Z" } ``` ``` -------------------------------- ### Retrieve Landing Page URL Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `getLandingPage()` method to retrieve the full URL of the landing page where the attribution tracking began. ```javascript const landingPage = tracker.getLandingPage(); ``` -------------------------------- ### getAdPlatformParameters() Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Retrieves ad platform-specific click and tracking IDs (e.g., Facebook, Google Ads, Twitter, Reddit, Meta) stored by the tracker. Returns an empty object if no parameters are found. ```APIDOC ## `getAdPlatformParameters()` ### Description Returns only the ad platform-specific click and tracking IDs from stored data. Covers parameters for Facebook (`fbclid`, `fb_source`, `fb_ref`), Google Ads (`gclid`, `gclsrc`, `dclid`, `gad_source`), Twitter (`twclid`, `tw_source`), Reddit (`rdt_cid`, `rdt_source`), and Meta (`mclid`). Returns an empty object if no ad platform parameters were captured. ### Method `tracker.getAdPlatformParameters()` ### Returns - `object`: An object containing ad platform parameters, or an empty object if none are found. ``` -------------------------------- ### getAdPlatformParameters() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Retrieves only ad platform-specific parameters from the stored attribution data. ```APIDOC ## `getAdPlatformParameters()` Returns only ad platform-specific parameters. ```javascript const adData = tracker.getAdPlatformParameters(); ``` ``` -------------------------------- ### getUtmParameters() Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Retrieves only the standard UTM parameters from the stored attribution data. Returns an empty object if no UTM parameters were captured. ```APIDOC ## getUtmParameters() ### Description Returns only the subset of stored data that corresponds to standard UTM parameters: `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, and `utm_term`. Returns an empty object if none of these keys were captured. Useful when only campaign-level data is needed without ad platform click IDs. ### Method GET (conceptual, as it's a method call) ### Endpoint N/A (Instance method) ### Parameters None ### Request Example ```javascript const tracker = new AttributionTracker(); const utm = tracker.getUtmParameters(); console.log(utm); // Example output: // { utm_source: 'google', utm_medium: 'email', utm_campaign: 'reengagement', utm_content: 'cta_button', utm_term: 'buy now' } // Send UTM data to a backend analytics endpoint fetch('/api/track', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ event: 'page_view', utm: tracker.getUtmParameters(), page: window.location.pathname }) }); ``` ### Response #### Success Response (200) - **utm parameters object** (object) - Contains only the captured UTM parameters (`utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`). - **empty object** - If no UTM parameters were captured. #### Response Example ```json { "utm_source": "google", "utm_medium": "email", "utm_campaign": "reengagement", "utm_content": "cta_button", "utm_term": "buy now" } ``` ``` -------------------------------- ### getUtmParameters() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Retrieves only UTM parameters from the stored attribution data. ```APIDOC ## `getUtmParameters()` Returns only UTM parameters from stored data. ```javascript const utmData = tracker.getUtmParameters(); ``` ``` -------------------------------- ### getReferrer() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Retrieves the initial HTTP referrer URL. ```APIDOC ## `getReferrer()` Returns the initial HTTP referrer URL. ```javascript const referrer = tracker.getReferrer(); ``` ``` -------------------------------- ### Custom Cookie Consent Integration with Attribution Tracker Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Extend `AttributionTracker` to override `checkCookieConsent()` for integration with a Consent Management Platform (CMP). This ensures cookies are only written after explicit user consent. Re-initialize the tracker if consent is granted later. ```javascript // Extend AttributionTracker to override consent logic class ConsentAwareTracker extends AttributionTracker { checkCookieConsent() { // OneTrust if (typeof OnetrustActiveGroups !== 'undefined') { return OnetrustActiveGroups.includes('C0002'); // Performance cookies } // Cookiebot if (typeof Cookiebot !== 'undefined') { return Cookiebot.consent.marketing; } // Custom CMP stored in localStorage try { const consent = JSON.parse(localStorage.getItem('user_consent') || '{}'); return consent.analytics === true; } catch { return false; // Deny by default if consent state is unreadable } } } // Use the consent-aware version const tracker = new ConsentAwareTracker({ cookieDuration: 30, additionalParams: ['affiliate_id'] }); // If user grants consent later, re-initialize to write the cookie document.getElementById('accept-cookies').addEventListener('click', () => { window.userConsent = { analytics: true }; localStorage.setItem('user_consent', JSON.stringify({ analytics: true })); tracker.initialize(); // Re-run initialization now that consent is granted }); ``` -------------------------------- ### Retrieve Only Ad Platform Parameters Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `getAdPlatformParameters()` method to retrieve only the ad platform-specific tracking IDs from the stored data. ```javascript const adData = tracker.getAdPlatformParameters(); ``` -------------------------------- ### getTimestamp() Source: https://context7.com/jasenf/attribution-tracker.js/llms.txt Returns the ISO 8601 timestamp string indicating when attribution data was first captured. Useful for time-to-conversion calculations and server-side validation. ```APIDOC ## `getTimestamp()` ### Description Returns the ISO 8601 timestamp string recording when attribution data was first captured. Useful for measuring time-to-conversion or filtering out stale attribution windows on the server side. ### Method `tracker.getTimestamp()` ### Returns - `string | null`: The ISO 8601 timestamp string, or `null` if attribution data has not yet been captured. ``` -------------------------------- ### Retrieve Only UTM Parameters Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `getUtmParameters()` method to specifically retrieve only the UTM parameters from the stored attribution data. ```javascript const utmData = tracker.getUtmParameters(); ``` -------------------------------- ### checkCookieConsent() Customization Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Guidance on how to modify the `checkCookieConsent` method to integrate with specific Consent Management Platforms (CMPs). ```APIDOC ## Cookie Consent and Privacy ⚠️ **Important Note About Cookie Consent** The included cookie consent checker is a generic implementation that may need to be modified based on your specific Consent Management Platform (CMP). The current implementation: 1. Checks for a global `window.cookieConsent` variable 2. Looks for common consent cookies 3. Defaults to false if no consent is found You should modify the `checkCookieConsent()` method to integrate with your specific CMP. Example implementations: ```javascript // OneTrust example checkCookieConsent() { return OnetrustActiveGroups.includes('C0002'); } // Cookiebot example checkCookieConsent() { return Cookiebot.consent.marketing; } // Custom implementation checkCookieConsent() { return yourConsentFunction(); } ``` ``` -------------------------------- ### Handle Attribution Data Actions Source: https://github.com/jasenf/attribution-tracker.js/blob/main/example.html Functions to retrieve and display all attribution data, only UTM parameters, or only ad platform parameters. The `clearData` function also resets the displayed data. ```javascript function showAllData() { displayData(tracker.getAll()); } ``` ```javascript function showUtmOnly() { displayData(tracker.getUtmParameters()); } ``` ```javascript function showAdPlatformOnly() { displayData(tracker.getAdPlatformParameters()); } ``` ```javascript function clearData() { tracker.clear(); displayData({}); } ``` -------------------------------- ### Display Attribution Data Source: https://github.com/jasenf/attribution-tracker.js/blob/main/example.html Helper function to display retrieved attribution data in a preformatted HTML element. It uses `JSON.stringify` for pretty-printing the data. ```javascript function displayData(data) { document.getElementById('attributionOutput').textContent = JSON.stringify(data, null, 2); } ``` -------------------------------- ### clear() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Clears all stored attribution data. ```APIDOC ## `clear()` Clears all stored attribution data. ```javascript tracker.clear(); ``` ``` -------------------------------- ### getTimestamp() Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Retrieves the timestamp when the attribution data was captured. ```APIDOC ## `getTimestamp()` Returns the timestamp when the attribution data was captured. ```javascript const timestamp = tracker.getTimestamp(); ``` ``` -------------------------------- ### Clear All Stored Attribution Data Source: https://github.com/jasenf/attribution-tracker.js/blob/main/readme.md Use the `clear()` method to remove all attribution data currently stored by the tracker. This is useful for privacy compliance or resetting tracking. ```javascript tracker.clear(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.