Set of methods that allow Eitri shopping apps to interact with Insider SDK.

Methods

  • Tracks when cart is cleared.

    Example:

    const modules = await Eitri.modules();
    const cartCleared = modules?.insider?.cartCleared;
    if (!cartCleared) return;
    await cartCleared()

    // Optionally attach custom parameters to the event
    await cartCleared({ customParameters: { trigger: "checkout" } })

    Parameters

    Returns Promise<undefined>

  • Tracks a click on a product returned by a Smart Recommender campaign.

    Call this once for each recommended product the user clicks. Doing so attributes the interaction to the recommendation campaign identified by recommendationID.

    Sequencing requirement: this must be called for a given product, in a given session, BEFORE tracking Add-to-Cart or Revenue for that same product. Add-to-Cart and Revenue are still tracked with the standard itemAddedToCart / itemPurchased methods (there are no recommender-specific variants); a matching prior click is what makes those events count toward the recommendation campaign. Those events may also carry the campaign as a customParameters tag (e.g. recommendation_id) for your own reporting, but that tag does not replace this click call for attribution.

    Example:

    const modules = await Eitri.modules();
    const clickSmartRecommendationProduct = modules?.insider?.clickSmartRecommendationProduct;
    if (!clickSmartRecommendationProduct) return;
    await clickSmartRecommendationProduct({
    recommendationID: 1,
    product: {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    }
    })

    Parameters

    • param: { product: InsiderProduct; recommendationID: number }

      Object containing the campaign ID and clicked product.

      • product: InsiderProduct

        The clicked recommended product.

      • recommendationID: number

        Campaign ID from the InOne panel.

    Returns Promise<undefined>

  • Builds and returns the JSON payload that the Insider SDK uses for its POST https://mobile.useinsider.com/api/v3/session/start request.

    The payload is assembled natively, using the same data sources the SDK itself reads (Insider ID, persisted UDID, partner name, app/OS/device context). This is intended for callers that need to replicate or augment the session-start call from JS — the bridge does NOT issue the HTTP request; the caller is responsible for that.

    The reason field is currently always "default".

    Example:

    const modules = await Eitri.modules();
    const getSessionStartPayload = modules?.insider?.getSessionStartPayload;
    if (!getSessionStartPayload) return;

    const payload = await getSessionStartPayload();
    await fetch("https://mobile.useinsider.com/api/v3/session/start", {
    method: "POST",
    headers: {
    "Content-Type": "application/json; charset=UTF-8",
    "X-Requested-With": payload.partner_name,
    "ts": String(Date.now())
    },
    body: JSON.stringify(payload)
    });

    Returns Promise<InsiderSessionStartPayload>

    The fully-assembled session-start payload.

  • Fetches a smart recommendation from the Insider Recommendation Engine for a given campaign.

    The Insider SDK resolves the recommendation asynchronously (network-backed callback), so this method returns a promise. The resolved value is the raw recommendation payload as delivered by the SDK — its shape is owned by Insider and should be treated defensively (see InsiderSmartRecommendation).

    Example:

    const modules = await Eitri.modules();
    const getSmartRecommendation = modules?.insider?.getSmartRecommendation;
    if (!getSmartRecommendation) return;

    const recommendation = await getSmartRecommendation({
    recommendationID: 1,
    locale: "pt_BR",
    currency: "BRL"
    });

    Parameters

    • param: { currency: string; locale: string; recommendationID: number }

      Object identifying the recommendation to fetch.

      • currency: string

        Currency code the recommendation prices are based on (e.g. "BRL").

      • locale: string

        Locale the recommendation data is retrieved for (e.g. "pt_BR").

      • recommendationID: number

        Campaign ID from the InOne panel.

    Returns Promise<InsiderSmartRecommendation>

    The recommendation payload from the Insider Recommendation Engine.

  • Fetches a smart recommendation based on a single product.

    Same async, pass-through semantics as getSmartRecommendation; the resolved value is the raw recommendation payload delivered by the SDK.

    Only productID is required — the other InsiderProduct fields are optional and forwarded to the SDK when provided.

    Example:

    const modules = await Eitri.modules();
    const getSmartRecommendationWithProduct = modules?.insider?.getSmartRecommendationWithProduct;
    if (!getSmartRecommendationWithProduct) return;

    const recommendation = await getSmartRecommendationWithProduct({
    product: { productID: "12345" },
    recommendationID: 1,
    locale: "pt_BR",
    currency: "BRL"
    });

    Parameters

    • param: {
          currency: string;
          locale: string;
          product: Partial<InsiderProduct> & Pick<InsiderProduct, "productID">;
          recommendationID: number;
      }

      Object identifying the recommendation to fetch.

      • currency: string

        Currency code the product is built with (e.g. "BRL").

      • locale: string

        Locale the recommendation data is retrieved for (e.g. "pt_BR").

      • product: Partial<InsiderProduct> & Pick<InsiderProduct, "productID">

        The source product. Only productID is required.

      • recommendationID: number

        Campaign ID from the InOne panel.

    Returns Promise<InsiderSmartRecommendation>

    The recommendation payload from the Insider Recommendation Engine.

  • Fetches a smart recommendation based on a set of product IDs.

    Same async, pass-through semantics as getSmartRecommendation; the resolved value is the raw recommendation payload delivered by the SDK.

    Example:

    const modules = await Eitri.modules();
    const getSmartRecommendationWithProductIDs = modules?.insider?.getSmartRecommendationWithProductIDs;
    if (!getSmartRecommendationWithProductIDs) return;

    const recommendation = await getSmartRecommendationWithProductIDs({
    productIDs: ["12345", "67890"],
    recommendationID: 1,
    locale: "pt_BR",
    currency: "BRL"
    });

    Parameters

    • param: {
          currency: string;
          locale: string;
          productIDs: string[];
          recommendationID: number;
      }

      Object identifying the recommendation to fetch.

      • currency: string

        Currency code the recommendation prices are based on (e.g. "BRL").

      • locale: string

        Locale the recommendation data is retrieved for (e.g. "pt_BR").

      • productIDs: string[]

        Product IDs the recommendation is based on.

      • recommendationID: number

        Campaign ID from the InOne panel.

    Returns Promise<InsiderSmartRecommendation>

    The recommendation payload from the Insider Recommendation Engine.

  • Tracks items added to cart.

    Example:

    const modules = await Eitri.modules();
    const itemAddedToCart = modules?.insider?.itemAddedToCart;
    if (!itemAddedToCart) return;
    await itemAddedToCart({
    product: {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    },
    customParameters: { quantity: 1 }
    })

    Smart Recommender: if the product was added from a Smart Recommender campaign, the add-to-cart is attributed by calling clickSmartRecommendationProduct first, in the same session, with the SAME productID — Insider maps the two events by product ID. You may additionally tag the event with the campaign via customParameters (e.g. recommendation_id) for your own reporting; the prior click call is what drives Insider's attribution, so keep it even when passing the tag.

    const product = {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    };
    // 1. Register the click on the recommended product first...
    await modules.insider.clickSmartRecommendationProduct({ recommendationID: 1, product });
    // 2. ...then the add-to-cart with the same product, so it is attributed.
    // Optionally tag it with the campaign for your own reporting.
    await modules.insider.itemAddedToCart({
    product,
    customParameters: { recommendation_id: 1 }
    });

    Parameters

    Returns Promise<undefined>

  • Tracks items added to wishlist.

    Example:

    const modules = await Eitri.modules();
    const itemAddedToWishlist = modules?.insider?.itemAddedToWishlist;
    if (!itemAddedToWishlist) return;
    await itemAddedToWishlist({
    product: {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    },
    customParameters: { source: "product_page" }
    })

    Parameters

    Returns Promise<undefined>

  • Tracks completed purchases.

    Example:

    const modules = await Eitri.modules();
    const itemPurchased = modules?.insider?.itemPurchased;
    if (!itemPurchased) return;
    await itemPurchased({
    saleID: "order_12345",
    product: {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    },
    customParameters: { paymentMethod: "credit_card" }
    })

    Smart Recommender: if the purchased product came from a Smart Recommender campaign, revenue is attributed by calling clickSmartRecommendationProduct first, in the same session, with the SAME productID — Insider maps revenue to the recommendation by product ID. You may additionally tag the event with the campaign via customParameters (e.g. recommendation_id) for your own reporting; the prior click call is what drives Insider's attribution, so keep it even when passing the tag.

    const product = {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    };
    // 1. Register the click on the recommended product first...
    await modules.insider.clickSmartRecommendationProduct({ recommendationID: 1, product });
    // 2. ...then the purchase with the same product, so revenue is attributed.
    // Optionally tag it with the campaign for your own reporting.
    await modules.insider.itemPurchased({
    saleID: "order_12345",
    product,
    customParameters: { recommendation_id: 1 }
    });

    Parameters

    Returns Promise<undefined>

  • Tracks items removed from cart.

    Example:

    const modules = await Eitri.modules();
    const itemRemovedFromCart = modules?.insider?.itemRemovedFromCart;
    if (!itemRemovedFromCart) return;
    await itemRemovedFromCart({
    productID: "12345",
    customParameters: { reason: "user_removed" }
    })

    Parameters

    • param: { customParameters?: InsiderCustomParameters; productID: string }

      Object containing product ID.

      • OptionalcustomParameters?: InsiderCustomParameters

        Optional key/value map of custom parameters forwarded to the Insider event.

      • productID: string

        Product identifier.

    Returns Promise<undefined>

  • Tracks items removed from wishlist.

    Example:

    const modules = await Eitri.modules();
    const itemRemovedFromWishlist = modules?.insider?.itemRemovedFromWishlist;
    if (!itemRemovedFromWishlist) return;
    await itemRemovedFromWishlist({
    productID: "12345",
    customParameters: { reason: "user_removed" }
    })

    Parameters

    • param: { customParameters?: InsiderCustomParameters; productID: string }

      Object containing product ID.

      • OptionalcustomParameters?: InsiderCustomParameters

        Optional key/value map of custom parameters forwarded to the Insider event.

      • productID: string

        Product identifier.

    Returns Promise<undefined>

  • Logs an event with Insider SDK, where each parameter of the event is defined as a key-value pair within the data object.

    Example:

    const modules = await Eitri.modules();
    const logEvent = modules?.insider?.logEvent;
    if (!logEvent) return;

    await logEvent({
    eventName: "product_view",
    data: {
    product_id: "12345",
    category: "electronics",
    price: 99.99
    }
    })

    Parameters

    • param: { data: Record<string, any>; eventName: string }

      Object describing the event.

      • data: Record<string, any>

        Object describing the event's data.

      • eventName: string

        Name of the event.

    Returns Promise<undefined>

  • Sets user opt-in preferences for Insider communication channels.

    Only the fields provided in the parameter object will be updated. Omitted fields will NOT be modified, allowing partial updates.

    Note: Push opt-in is automatically set to true during SDK initialization and user login. Location opt-in is automatically set to true when startGeofenceTracking() is called. Use this method to explicitly override those defaults or to set email/SMS/WhatsApp opt-ins.

    Example:

    const modules = await Eitri.modules();
    const setUserOptins = modules?.insider?.setUserOptins;
    if (!setUserOptins) return;

    // Set multiple opt-ins at once
    await setUserOptins({
    email: true,
    sms: true,
    whatsapp: false
    })

    // Or set a single opt-in
    await setUserOptins({ email: false })

    Parameters

    • optins: InsiderUserOptins

      Object containing opt-in preferences. Only provided fields will be updated.

    Returns Promise<undefined>

  • Tracks user sign-up confirmations.

    Example:

    const modules = await Eitri.modules();
    const signUpConfirmation = modules?.insider?.signUpConfirmation;
    if (!signUpConfirmation) return;
    await signUpConfirmation()

    // Optionally attach custom parameters to the event
    await signUpConfirmation({ customParameters: { plan: "premium" } })

    Parameters

    Returns Promise<undefined>

  • Starts geofence tracking for location-based marketing campaigns.

    Requires location permissions to be granted by the user to call this.

    You must call it once per app app launch, ideally on app start and after permissions handling.

    Users must allow "Always" and "Precise Location" permissions for geofencing to work correctly.

    Example:

    // Ensure that the methods exist
    const modules = await Eitri.modules();
    const upgradeToBackgroundPermission = modules?.geolocation?.upgradeToBackgroundPermission;
    const startGeofenceTracking = modules?.insider?.startGeofenceTracking

    if (!upgradeToBackgroundPermission) {
    console.log("upgradeToBackgroundPermission is not available");
    return;
    }

    if (!startGeofenceTracking) {
    console.log("startGeofenceTracking is not available");
    return;
    }

    // Check and request location permissions

    // First ensure foreground permission
    const foreground = await modules.geolocation.requestPermission({precision: "precise"});
    if (foreground.status != "GRANTED") {
    console.log("Location permission not granted");
    return;
    }

    // Explain to the user why background permission is needed, then request it

    // Try upgrade to background
    const background = await upgradeToBackgroundPermission();

    // Then start geofence tracking
    await startGeofenceTracking()

    Returns Promise<undefined>

  • Tracks cart page visits.

    Example:

    const modules = await Eitri.modules();
    const visitCartPage = modules?.insider?.visitCartPage;
    if (!visitCartPage) return;
    await visitCartPage({
    products: [{
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    }],
    customParameters: { cartValue: 999.99 }
    })

    Parameters

    Returns Promise<undefined>

  • Tracks homepage visits.

    Example:

    const modules = await Eitri.modules();
    const visitHomepage = modules?.insider?.visitHomepage;
    if (!visitHomepage) return;
    await visitHomepage()

    // Optionally attach custom parameters to the event
    await visitHomepage({ customParameters: { campaign: "summer_sale" } })

    Parameters

    Returns Promise<undefined>

  • Tracks listing/category page visits.

    Example:

    const modules = await Eitri.modules();
    const visitListingPage = modules?.insider?.visitListingPage;
    if (!visitListingPage) return;
    await visitListingPage({
    taxonomy: ["electronics", "smartphones"],
    customParameters: { source: "search" }
    })

    Parameters

    • param: { customParameters?: InsiderCustomParameters; taxonomy: string[] }

      Object containing taxonomy information.

      • OptionalcustomParameters?: InsiderCustomParameters

        Optional key/value map of custom parameters forwarded to the Insider event.

      • taxonomy: string[]

        Array of category strings.

    Returns Promise<undefined>

  • Tracks product detail page visits.

    Example:

    const modules = await Eitri.modules();
    const visitProductDetailPage = modules?.insider?.visitProductDetailPage;
    if (!visitProductDetailPage) return;
    await visitProductDetailPage({
    product: {
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    },
    customParameters: { referrer: "banner" }
    })

    Parameters

    Returns Promise<undefined>

  • Tracks wishlist page visits.

    Example:

    const modules = await Eitri.modules();
    const visitWishlistPage = modules?.insider?.visitWishlistPage;
    if (!visitWishlistPage) return;
    await visitWishlistPage({
    products: [{
    productID: "12345",
    name: "iPhone 15",
    taxonomy: ["electronics", "smartphones"],
    imageURL: "https://example.com/iphone15.jpg",
    price: 999.99,
    currency: "USD"
    }],
    customParameters: { wishlistSize: 1 }
    })

    Parameters

    Returns Promise<undefined>

  • Tracks when wishlist is cleared.

    Example:

    const modules = await Eitri.modules();
    const wishlistCleared = modules?.insider?.wishlistCleared;
    if (!wishlistCleared) return;
    await wishlistCleared()

    // Optionally attach custom parameters to the event
    await wishlistCleared({ customParameters: { trigger: "manual" } })

    Parameters

    Returns Promise<undefined>