How to add a custom parameter for a large io Web Auto-Collection

I am using interesting events to create a web collection like page views, clicks and form submission. I want to add custom parameters like User ID, Org ID, Org Name for these events. How can i do this?

+3


source to share


2 answers


Try using the expand events method to add additional properties to the events dispatched with the auto-collector.



// Extend events for a single collection
client.extendEvent('transaction', {});
client.extendEvent('transaction', function(){
	return {};
});

// Extend events for all collections
client.extendEvents({});
client.extendEvents(function(){
	return {};
});

// Example usage

var userProps = {
	full_name: 'User Dude',
	email: 'name@domain.com',
	id: 'f1233423h',
	username: 'userdude213'
};

// Include a predefined 'user' object with every purchase event
client.extendEvent('purchases', {
	'user': userProps
});

// Include a predefined 'user' object with every event
client.extendEvents({
	'user': userProps
});

// Include a dynamic 'keen.timestamp' property with every event
client.extendEvents(function(){
	return {
		keen: {
			timestamp: new Date().toISOString()
		}
	};
});
      

Run codeHide result


+2


source


This is the small snippet I am using to enter extended data into Keen IO Web Auto-Collection:

window.keenWebAutoCollector.onload(function(){

    var userProps = {
        username : "Any given username",
        uid  : 123,
        other: "data"
    };

    window.keenWebAutoCollector.tracker.extendEvents({
        'user': userProps
    });
});

      



This snippet should be added after the code for Auto-Collector ( https://keen.io/docs/streams/web-auto-collection/ ).

And this will increase the property user

for all collection events triggered by the Auto-collector (pageviews, clicks and forms).

+1


source







All Articles