Closed josephwegner closed 9 years ago
Here's an example event definition for an input change:
{
"page_url": "http://localhost:3000/index.html",
"referrer_url": "http://localhost:3000/",
"keen": {
"addons": [{
"name": "keen:ip_to_geo",
"input": {
"ip": "ip_address"
},
"output": "ip_geo_info"
}, {
"name": "keen:ua_parser",
"input": {
"ua_string": "user_agent"
},
"output": "parsed_user_agent"
}, {
"name": "keen:url_parser",
"input": {
"url": "page_url"
},
"output": "parsed_page_url"
}, {
"name": "keen:referrer_parser",
"input": {
"referrer_url": "referrer_url",
"page_url": "page_url"
},
"output": "referrer_info"
}]
},
"ip_address": "${keen.ip}",
"user_agent": "${keen.user_agent}",
"element": {
"value": "facepalm",
"form": {
"tagName": "FORM",
"method": "GET",
"action": "./index.html",
"data-six": "six",
"path": "html > body > form"
},
"tagName": "INPUT",
"type": "text",
"name": "text field",
"id": "text_field",
"placeholder": "Type something",
"path": "html > body > form > input#text_field",
"previousValue": "test"
},
"event": {
"type": "change",
"metaKey": false
}
}
Most fantastic. Some interesting applications here around text but also select boxes, radios, and the like.
Looks like you might need to rebase your branch onto updated master before we merge in. If you can take care of that we should be all set.
Will rebase tomorrow. Thanks!
— Sent from Mailbox
On Tue, Mar 3, 2015 at 7:26 PM, Josh Dzielak notifications@github.com wrote:
Looks like you might need to rebase your branch onto updated master before we merge in. If you can take care of that we should be all set.
Reply to this email directly or view it on GitHub: https://github.com/keen/common-web/pull/12#issuecomment-77079545
OK, changed the event name, and rebased. Should be good to go now.
Merged!
This adds a new tracking function,
trackInputChanges
. That will bind on thechange
event of all inputs on the page, and track them. It tracks the previous value, and also passes along information about the parent form, if available.I also fixes two bugs in
trackFormSubmissions
:trackFormSubmissions
without passing a set of elements. That wasn't the case. It is now.id
of the element internally. Now that internal call just selects the actual element. This removes the requirement for anid
attribute, and is probably also faster.