Enableformtracking data payload issue javascript

Used enableformtracking method available over the documentation but getting an error in snowplow as
“{“message”:”.value: may only be 64 characters long","path":".value",“keyword”:“maxLength”,“targets”:[“64”]}".
Can we increase the limit of the value field from 64 characters to whatever limit we want .
Please help me out.

Hi Abhinav,

Enable form tracking switches on tracking for three different things - change_form events, focus_form events and submit_form events.

Looks like the schema for focus form events restricts field lengths, where the other two don’t.

I’ve submitted an issue to look into fixing that.

Change form and submit form events should remain unaffected - hopefully that doesn’t impact analysis too much.

Hi Colm,
Actually, that is affecting our analytics journey somewhere request you to give some alternative solutions

As far as workarounds go, you have to options:

  1. Create a copy of the schema, remove the maxLength conditions, and leave everything else the same. Upload that schema to the same path within your own Iglu Server, then set your iglu resolver so that the priority of your Iglu Server is before Iglu Central.

  2. Instrument your own listeners for focus form events in the web page and track them as custom events.

1 Like

I think option 1 that @Colm suggests is the best solution until we fix the schema. However, if you want to solve this tracker side, you can leverage the field transformations to trim the values to 64 characters. You’ll lose some of the value when the value exceeds 64 characters but you won’t end up with bad events this way.

var config = {
  fields: {
    transform: function (value, elt) {       // elt only passed in 2.15.0+
      if (value && typeof value === 'string') {
        return value.substring(0, 64);

      return value;

snowplow('enableFormTracking', config);
1 Like

Hi PaulBoocock,
What if I change the schema on my own iglu bucket ?

If you change the schema in your own bucket, then as long as you give it the same vendor, name and version then you shouldn’t need to make any changes. Just ensure your iglu bucket is above iglu central in priority within your iglu resolvers.

Thanks, PaulBoocock and Colm, the solution you gave is really appreciable, but I have another question, can we track checkboxes and these kind of stuffs which are besides any form on any page, can we track this using this method only ??
Please let me know, I’m quite new in this field.

Form tracking will only track form elements. For other elements on the page you’ll need to instrument custom events.

how can we make a generic custom event on a platform so that they can trigger anytime on any page for a particular type of checkboxes and radio buttons so that when anybody checks them event gets fired and we can get the data

Here is the documentation for tracking custom events.

You’ll need to write some javascript to track one of those for the interactions you’re interested in tracking.