Form submission

First of all: I used the search and have read some posts, but they didn’t helped me.

What i want to do is:

There for I created a goal and track it like this:

piwikTracker.trackGoal(2, $(this).serialize().replace(/effects%5B%5D=/gi, ‘’).replace(/&/gi, ', '));
}, 500);

The goal is tracked correctly, but the second argument which is a comma serparated list of the checked checkboxes isn’t.

Do you have any ideas, how could track this properly?

The second parameter to trackGoal() is the Revenue, an integer or float number for money revenue (or equivalent) see Track Goals and Measure Conversions - Analytics Platform - Matomo

However, with Piwik you can track custom variables for Goals. Use a “Visit” session custom variables (eg. name = “Checkboxes” and value = comma-separated-checkbox-names

See Custom Variables Analytics - Analytics Platform - Matomo

Call the setCustomVariable(…) just before trackGoal and it will work oK and display reports in Visitors > Custom Variables, or even just in the Goal > goal X > Custom variables


Thank you :slight_smile:
This solution works great for me.

Here is the final code:

	var $this = $(this);
		var value = $this.serialize().replace(/effects%5B%5D\=/gi, '').replace(/&/gi, ', ');
		piwikTracker.setCustomVariable(1, 'effects', value, 'visit');
	}, 500);