ucc-sdk
Version:
UnchainedCarrot SDK
26 lines (24 loc) • 829 B
JavaScript
// track methods
import { _submitEvent } from '../track/ucc-web-tracker';
/**
* Send UCC Web Page Event.
* @function
* @memberof track
* @returns {Promise<any>} Web Tracking Response
*/
function pageEvent() {
return _submitEvent({
event: 'PAGE_VIEWED',
data: {
protocol: (window && window.location) ? window.location.protocol : null,
host: (window && window.location) ? window.location.host : null,
port: (window && window.location) ? window.location.port : null,
origin: (window && window.location) ? window.location.origin : null,
pathname: (window && window.location) ? window.location.pathname : null,
url: (window && window.location) ? window.location.href : null
},
user: {},
type: 'page'
});
}
export const _pageEvent = pageEvent;