Skip to main content

Extend Tracking Parameters

The extendTrackingParameters action is used to add tracking parameters to be appended to any outgoing links within the widget. This can be used to for better user tracking.

Usage

To extend tracking parameters within the widget, call the extendTrackingParameters method on the widget instance with a second object param:

window._asurion_widget('extendTrackingParameters', { foo: 'bar' });

The type signature of the extendTrackingParameters method is as follows

(params: Record<string, string>) => void

Examples

Adding new context

The data passed to extendTrackingParameters will be merged with what currently exists in context.

/*
Existing Tracking Parameters
{
"foo": "bar",
"baz": "foo"
}
*/

window._asurion_widget('extendTrackingParameters', { utm_source: 'new_users' });

/*
Extended context
{
"foo": "bar",
"baz": "foo",
"utm_source": "new_users"
}
*/

Overriding existing context

/*
Existing Context
{
"foo": "bar",
"baz": "foo"
}
*/

window._asurion_widget('extendTrackingParameters', { foo: undefined, baz: 'bar' });

/*
Extended context
{
"baz": "bar"
}
*/