{"_id":"57d9be6d608ea00e00f358de","project":"5668fab608f90021008e882f","__v":1,"githubsync":"","user":"5668fa9755e4b32100935d41","category":{"_id":"569742bd0b09a41900b2446c","__v":9,"pages":["5697455824490c3700170a69","569747128400d52d00dd56a4","5697476b8560a60d00e2c262","569747a4c8ded91700307b92","5697489c59a6692d003fad96","56a1500244f3d80d00a2c388","56a2c51906150b0d002ad264","56b548b75f1cf00d00cc4773","56b54ae37719bb1900143093"],"project":"5668fab608f90021008e882f","version":"5668fab608f90021008e8832","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-14T06:39:57.496Z","from_sync":false,"order":6,"slug":"tuning-liftigniter-javascript","title":"Rendering,Tracking and A/B Testing Widgets (JavaScript)"},"version":{"_id":"5668fab608f90021008e8832","__v":19,"project":"5668fab608f90021008e882f","createdAt":"2015-12-10T04:08:22.769Z","releaseDate":"2015-12-10T04:08:22.769Z","categories":["5668fab708f90021008e8833","569740f124490c3700170a64","569742b58560a60d00e2c25d","569742bd0b09a41900b2446c","569742cd69393517000c82b3","569742f459a6692d003fad8f","569743020b09a41900b2446d","5697430b69393517000c82b5","56a17776470ae00d00c30642","56a2c48a831e2a0d0069b1ad","56b535757bccae0d00e9a1cd","56e1ff6aa49fdc0e005746b5","57e1c88115bf6522002a5e4e","57fa65275ba65a17008b988f","57fbeea34002550e004c032e","58474584889b6c2d00fb86e9","58475dcc64157f0f002f1907","587e7b5158666c2700965d4e","58a349fc30852819007ba083"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.18.0","version":"1.18"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-14T21:17:33.137Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Defining conversion events\",\n  \"body\": \"Sending an event named 'conversion' will provide feedback to our system. `conversion_t` is used to classify different events so that you can get detailed breakdown of events.\\n\\nConversion events are optional but make sense for e-commerce and B2B customers. Feel free to get in touch with the LiftIgniter team at support:::at:::liftigniter.com to discuss your conversion typology.\\n\\nIf you do not have any conversion events to send, you can skip this section.\"\n}\n[/block]\nThink of our JS SDK as a Google Analytics script. In principle, you can track ***ANY*** custom events that you would like us to look into - and we can use `conversion` or `engaged` events as an activity for training our model.\n\nUsing $p(\"send\") at the time conversion/engagement occurs will allow our system to track the event.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Send conversion event\\n// Track Twitter Follow\\n$p(\\\"send\\\", \\\"conversion\\\",{\\n  // Context object.\\n  // If you want to say that the conversion is from LiftIgniter and conversion type\\n  source: \\\"LI\\\",\\n  conversion_t: \\\"twitter follow\\\"\\n})\\n\\n// Send conversion event\\n// Track ecommerce conversion\\n$p(\\\"send\\\", \\\"conversion\\\",{\\n  // Context object.\\n  // If you want to say that the conversion is from LiftIgniter and conversion_t\\n  source: \\\"LI\\\",\\n  conversion_t: \\\"add to cart\\\",\\n  id: \\\"PRODUCT_ID\\\",\\n  price: 1.0\\n})\\n\\n$p(\\\"send\\\", \\\"conversion\\\",{\\n  source: \\\"LI\\\",\\n  conversion_t: \\\"purchase\\\",\\n  id: \\\"PRODUCT_ID\\\",\\n  price: 1.0\\n})\\n\\n// Send engagement event\\n// Track video engagement activity (i.e. watch 20% of video)\\n$p(\\\"send\\\", \\\"engaged\\\",{\\n\\tsource: \\\"LI\\\",\\n  conversion_t: \\\"video complete\\\"\\n})\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nCode above will send us conversion event and engaged event respectively. If you are sending us conversion on an e-commerce site, make sure you include the product ID on the `id` field by the item identifier you are using to store on our side.\n\nAs usual, the value of context object can be any data type that's supported by us (Number, String, and Array of String). `conversion` and `engaged` are events commonly tracked by our system. But if you want us to consider anything else into the model, then please contact us about it and we can look into it.\n[block:api-header]\n{\n  \"title\": \"How to decide the source\"\n}\n[/block]\nIf you are running an A/B test, and attributing only the conversions due to a click on LI widget as \"LI\", then we recommend labelling the source as \"base\" for conversion from same widget on alternative A/B slice. You can name any other conversion sources as \"other\", or any identifier that you can recognize.\n\nIf you don't have the capacity to implement such a granular tracking for conversion, then you can simply label all conversions for users on LI slice as \"LI\" and alternative as \"base\" to compare the overall numbers.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"How to identify items were added due to LiftIgniter click\"\n}\n[/block]\nYou can use this solution if you don't internally track what the users clicked on. \n\nOn the user's local storage, `_igClkHis` key stores a stringified JavaScript string array. This array keeps track of 10 most recent things a user has clicked on for a given widget. Each of the string value in the string array is a pipe ('|') separated value that contains the URL user clicked on, name of the widget clicked from, and source (who served the algorithm. Default `base` or LiftIgniter `LI`).\n\nYou can use this to keep track of conversion based on direct click. Deeper investigation (i.e. how does having the widget shown affect conversion and etc) can be done on our end.","excerpt":"","slug":"tracking-conversion","type":"basic","title":"Tracking Conversion"}

Tracking Conversion


[block:callout] { "type": "info", "title": "Defining conversion events", "body": "Sending an event named 'conversion' will provide feedback to our system. `conversion_t` is used to classify different events so that you can get detailed breakdown of events.\n\nConversion events are optional but make sense for e-commerce and B2B customers. Feel free to get in touch with the LiftIgniter team at support@liftigniter.com to discuss your conversion typology.\n\nIf you do not have any conversion events to send, you can skip this section." } [/block] Think of our JS SDK as a Google Analytics script. In principle, you can track ***ANY*** custom events that you would like us to look into - and we can use `conversion` or `engaged` events as an activity for training our model. Using $p("send") at the time conversion/engagement occurs will allow our system to track the event. [block:code] { "codes": [ { "code": "// Send conversion event\n// Track Twitter Follow\n$p(\"send\", \"conversion\",{\n // Context object.\n // If you want to say that the conversion is from LiftIgniter and conversion type\n source: \"LI\",\n conversion_t: \"twitter follow\"\n})\n\n// Send conversion event\n// Track ecommerce conversion\n$p(\"send\", \"conversion\",{\n // Context object.\n // If you want to say that the conversion is from LiftIgniter and conversion_t\n source: \"LI\",\n conversion_t: \"add to cart\",\n id: \"PRODUCT_ID\",\n price: 1.0\n})\n\n$p(\"send\", \"conversion\",{\n source: \"LI\",\n conversion_t: \"purchase\",\n id: \"PRODUCT_ID\",\n price: 1.0\n})\n\n// Send engagement event\n// Track video engagement activity (i.e. watch 20% of video)\n$p(\"send\", \"engaged\",{\n\tsource: \"LI\",\n conversion_t: \"video complete\"\n})", "language": "javascript" } ] } [/block] Code above will send us conversion event and engaged event respectively. If you are sending us conversion on an e-commerce site, make sure you include the product ID on the `id` field by the item identifier you are using to store on our side. As usual, the value of context object can be any data type that's supported by us (Number, String, and Array of String). `conversion` and `engaged` are events commonly tracked by our system. But if you want us to consider anything else into the model, then please contact us about it and we can look into it. [block:api-header] { "title": "How to decide the source" } [/block] If you are running an A/B test, and attributing only the conversions due to a click on LI widget as "LI", then we recommend labelling the source as "base" for conversion from same widget on alternative A/B slice. You can name any other conversion sources as "other", or any identifier that you can recognize. If you don't have the capacity to implement such a granular tracking for conversion, then you can simply label all conversions for users on LI slice as "LI" and alternative as "base" to compare the overall numbers. [block:api-header] { "type": "basic", "title": "How to identify items were added due to LiftIgniter click" } [/block] You can use this solution if you don't internally track what the users clicked on. On the user's local storage, `_igClkHis` key stores a stringified JavaScript string array. This array keeps track of 10 most recent things a user has clicked on for a given widget. Each of the string value in the string array is a pipe ('|') separated value that contains the URL user clicked on, name of the widget clicked from, and source (who served the algorithm. Default `base` or LiftIgniter `LI`). You can use this to keep track of conversion based on direct click. Deeper investigation (i.e. how does having the widget shown affect conversion and etc) can be done on our end.