diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..613a00e
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,4 @@
+### v1.0.1
+
+- Minor bugfix
+- Documentation update
\ No newline at end of file
diff --git a/README.md b/README.md
index 80c3bb9..a8dac46 100644
--- a/README.md
+++ b/README.md
@@ -25,8 +25,8 @@ npm i @razorpay/lytics --save
Unpkg
```html
-
```
@@ -46,13 +46,14 @@ Initialise lytics:
```js
lytics.init({
- parent: '#myContainer',
- track: (props, callback) => {
- trackAnalyticsForWebsite(props).then(() => {
- callback();
- });
- },
-});
+ parent: '#myContainer',
+ tracker: (props, callback) => {
+ trackAnalyticsForWebsite(props)
+ .then(() => {
+ callback();
+ });
+ }
+})
```
# Documentation
@@ -76,7 +77,7 @@ Currently, only two types of triggers are supported:
| Property | Type | Default | Description |
| --------------- | --------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| parent | String or HTMLElement | `document.documentElement` | Parent element or selector. Delegated events will be listened from this element. |
-| track | Function | (p, cb) => cb(); | Function that gets two parameters: `props`, `callback`. Make sure to invoke callback in the tracking method that you provide. |
+| tracker | Function | (p, cb) => cb(); | Function that gets two parameters: `props`, `callback`. Make sure to invoke callback in the tracking method that you provide. |
| ignoreSynthetic | Boolean | `true` | Whether or not to ignore synthetic events. Synthetic events are events triggered programmatically. |
| timeout | Number | 300 | Timeout for automatic invocation of callback. If the callback isn't executed within `timeout` ms by you, it will automatically be executed. |
diff --git a/dist/lytics.js b/dist/lytics.js
index 15055ec..03f5813 100644
--- a/dist/lytics.js
+++ b/dist/lytics.js
@@ -1 +1 @@
-(function () {var a={};function l(t){return t.split("-").map(function(t,e){return 0===e?t:t[0].toUpperCase()+t.slice(1,t.length)}).join("")}function g(t){for(var e=[],r=0;r2&&void 0!==arguments[2]?arguments[2]:"click",e=arguments.length>3?arguments[3]:void 0,$=arguments.length>4?arguments[4]:void 0;if(r){var c=d(r);c.trigger&&c.trigger===a&&k(r,t,a,e,$)}}function m(t){return t.ctrlKey||t.metaKey||t.shiftKey}function n(t,e){if(!m(t))return t.preventDefault(),e}function f(t,e,a){var r=t.call(null,e,a);return r&&(r=n(a,r)),r}function p(t){var e=t.getAttribute("target");if(!e||"_self"===e)return function(){var e=t.getAttribute("href");e&&(window.location.href=e)}}function q(t){var e=t.getAttribute("target");if(!e||"_self"===e)return function(){t.submit()}}function s(t,e){var a=!1;return e>0&&setTimeout(function(){a=!0,t()},e),function(){a||(a=!0,t())}}c.initListeners=i;var u=function(e,t){t()};function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.parent,r=void 0===t?document.documentElement:t,$=e.tracker,i=void 0===$?u:$,o=e.ignoreSynthetic,n=void 0===o||o,s=e.timeout,b=void 0===s?300:s;if("string"==typeof r&&(r=document.querySelector(r)),r instanceof HTMLElement)return{off:c.initListeners(r,i,n,b)}}var t=r;a.init=t;var e=d;a.getAttributesOfEl=e;if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=a}else if(typeof define==="function"&&define.amd){define(function(){return a})}else{this["lytics"]=a}})();
\ No newline at end of file
+(function () {var a={};function l(t){return t.split("-").map(function(t,e){return 0===e?t:t[0].toUpperCase()+t.slice(1,t.length)}).join("")}function g(t){for(var e=[],r=0;r2&&void 0!==arguments[2]?arguments[2]:"click",e=arguments.length>3?arguments[3]:void 0,$=arguments.length>4?arguments[4]:void 0;if(r){var c=d(r);c.trigger&&c.trigger===a&&k(r,t,a,e,$)}}function m(t){return t.ctrlKey||t.metaKey||t.shiftKey}function n(t,e){if(!m(t))return t.preventDefault(),e}function f(t,e,a){var r=t.call(null,e,a);return r&&(r=n(a,r)),r}function p(t){var e=t.getAttribute("target");if(!e||"_self"===e)return function(){var e=t.getAttribute("href");e&&(window.location.href=e)}}function q(t){var e=t.getAttribute("target");if(!e||"_self"===e)return function(){t.submit()}}function s(t,e){var a=!1;return e>0&&setTimeout(function(){a=!0,t()},e),function(){a||(a=!0,t())}}c.initListeners=i;var u=function(e,t){t()};function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.parent,r=void 0===t?document.documentElement:t,$=e.tracker,i=void 0===$?u:$,o=e.ignoreSynthetic,n=void 0===o||o,s=e.timeout,b=void 0===s?300:s;if("string"==typeof r&&(r=document.querySelector(r)),r instanceof HTMLElement)return{off:c.initListeners(r,i,n,b)}}var t=r;a.init=t;var e=d;a.getAttributesOfEl=e;if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=a}else if(typeof define==="function"&&define.amd){define(function(){return a})}else{this["lytics"]=a}})();
\ No newline at end of file
diff --git a/package.json b/package.json
index 4e456e5..94fa288 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@razorpay/lytics",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "Simpler analytics using HTML attributes.",
"main": "dist/lytics",
"scripts": {
diff --git a/utils/listeners.js b/utils/listeners.js
index f2a3c86..74cd854 100644
--- a/utils/listeners.js
+++ b/utils/listeners.js
@@ -49,7 +49,7 @@ export function initListeners(parent, tracker, ignoreSynthetic, timeout) {
const submit = createAndAttachListener('submit', parent, tracker, ignoreSynthetic, timeout);
return () => {
- click();
- submit();
+ click && click();
+ submit && submit();
}
}
\ No newline at end of file