get Client Browser Parameters
Gathers client browser values commonly used for analytics
Anchor to getClientBrowserParametersget Client Browser Parameters()
If executed on server, this method will return empty string for each field.
- uniqueTokenuniqueTokenstringstring
Shopify unique user token: Value of
cookie.Use
to collect this value.- visitTokenvisitTokenstringstring
Shopify session token: Value of
cookie.Use
to collect this value.- urlurlstringstring
Value of
window.location.href.Use
to collect this value.- pathpathstringstring
Value of
window.location.pathname.Use
to collect this value.- searchsearchstringstring
Value of
window.location.search.Use
to collect this value.- referrerreferrerstringstring
Value of
window.document.referrer.Use
to collect this value.- titletitlestringstring
Value of
document.title.Use
to collect this value.- userAgentuserAgentstringstring
Value of
.Use
to collect this value.- navigationTypenavigationTypestringstring
Navigation type:
.Use
to collect this value.- navigationApinavigationApistringstring
Navigation api:
.Use
to collect this value.
ClientBrowserParameters
ClientBrowserParameters
- uniqueToken
Shopify unique user token: Value of `_shopify_y` cookie. Use `getClientBrowserParameters()` to collect this value.
string - visitToken
Shopify session token: Value of `_shopify_s` cookie. Use `getClientBrowserParameters()` to collect this value.
string - url
Value of `window.location.href`. Use `getClientBrowserParameters()` to collect this value.
string - path
Value of `window.location.pathname`. Use `getClientBrowserParameters()` to collect this value.
string - search
Value of `window.location.search`. Use `getClientBrowserParameters()` to collect this value.
string - referrer
Value of `window.document.referrer`. Use `getClientBrowserParameters()` to collect this value.
string - title
Value of `document.title`. Use `getClientBrowserParameters()` to collect this value.
string - userAgent
Value of `navigator.userAgent`. Use `getClientBrowserParameters()` to collect this value.
string - navigationType
Navigation type: `'navigate' | 'reload' | 'back_forward' | 'prerender' | 'unknown'`. Use `getClientBrowserParameters()` to collect this value.
string - navigationApi
Navigation api: `'PerformanceNavigationTiming' | 'performance.navigation'`. Use `getClientBrowserParameters()` to collect this value.
string
{
/**
* Shopify unique user token: Value of `_shopify_y` cookie.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
uniqueToken: string;
/**
* Shopify session token: Value of `_shopify_s` cookie.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
visitToken: string;
/**
* Value of `window.location.href`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
url: string;
/**
* Value of `window.location.pathname`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
path: string;
/**
* Value of `window.location.search`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
search: string;
/**
* Value of `window.document.referrer`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
referrer: string;
/**
* Value of `document.title`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
title: string;
/**
* Value of `navigator.userAgent`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
userAgent: string;
/**
* Navigation type: `'navigate' | 'reload' | 'back_forward' | 'prerender' | 'unknown'`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
navigationType: string;
/**
* Navigation api: `'PerformanceNavigationTiming' | 'performance.navigation'`.
*
* Use `getClientBrowserParameters()` to collect this value.
**/
navigationApi: string;
}Examples
Example code
Description
I am the default example
JavaScript
import * as React from 'react'; import {useEffect} from 'react'; import {getClientBrowserParameters} from '@shopify/hydrogen'; export default function App({Component, pageProps}) { useEffect(() => { getClientBrowserParameters(); }); return <Component {...pageProps} />; }TypeScript
import * as React from 'react'; import {useEffect} from 'react'; import {getClientBrowserParameters} from '@shopify/hydrogen'; export default function App({Component, pageProps}) { useEffect(() => { getClientBrowserParameters(); }); return <Component {...pageProps} />; }