Skip to main content

Web To Mobile

Definition

The document provides guidance on how a Web To Mobile application can supply mobile attributes and the user's tracking-consent decision to the Pulse SDK.

Web to Mobile Meta Info

To provide the web-to-mobile meta information to the Pulse SDK, ensure the information is stored in cookie storage under the w2m_meta_info key before the page loads. The object should be converted to a string format and stored as a string value.

If cookie access is restricted in your WebView configuration, the same string may be written to localStorage under the same key instead. Pulse reads the cookie first and falls back to localStorage.

caution

The value must be written before the page loads. Pulse reads it once during initialization; a value written afterwards is not picked up until the next page load.

The schema of provided Info

{
'device_id': string,
'session_id': string,
'mobile_attributes': Record<string, any>
'performance_cookie_accepted': boolean
}

Web To Mobile pages are rendered inside the application's WebView, where no web cookie-consent banner runs. The user answered the banner natively in the application, so the application has to pass that answer on to Pulse.

Provide it as performance_cookie_accepted on the same w2m_meta_info payload:

ValueBehaviour
trueThe user accepted. Pulse tracks.
falseThe user did not accept. Pulse does not track — no events are sent.
property absentPulse falls back to the consent behaviour configured for the origin.
caution

The value must be a real JSON boolean. A quoted string such as "true" is not treated as a decision — Pulse ignores it and falls back to the configured behaviour, which in most regions means tracking does not start.

Example

const metaInfo = {
device_id: "5b1a...c7",
session_id: "1755...42",
mobile_attributes: { app_version: "25.8.0" },
performance_cookie_accepted: true,
};

document.cookie = `w2m_meta_info=${encodeURIComponent(JSON.stringify(metaInfo))}; path=/`;
caution

The payload contains commas, and a comma terminates a cookie value. Encode the value with encodeURIComponent before writing it, as shown above.

When the decision changes

The consent answer is read once, at page load. There is no banner on a Web To Mobile page to change it mid-session, so the value the application wrote before the page loaded is final for that page.

If the user changes their decision in the application, write the new value and load the page again.

Pulse does not fire its consent_change event on Web To Mobile pages. The application collected the consent answer through its own native banner and reports it on the mobile side, so reporting it again from the web page would duplicate it.

For the same reason, a consent answer on a Web To Mobile page does not start a new session. The session stays the one the application provided through session_id, which is what keeps the application and web parts of the funnel joined as a single user.