{"_id":"57e16de7c4711017001cad86","category":{"_id":"569742b58560a60d00e2c25d","__v":2,"pages":["5697436959a6692d003fad90","5697445759a6692d003fad92"],"project":"5668fab608f90021008e882f","version":"5668fab608f90021008e8832","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-14T06:39:49.331Z","from_sync":false,"order":4,"slug":"javascript-integration-guide","title":"Javascript SDK Integration Guide"},"project":"5668fab608f90021008e882f","__v":1,"githubsync":"","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"},"user":"5668fa9755e4b32100935d41","parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-20T17:12:07.759Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Recommendation Quality\",\n  \"body\": \"At this point you have integrated our `beacon` to your website. \\n\\nWe start analyzing your traffic right from the moment we start receiving pageviews, and serve recommendations within 30 minutes. However, we recommend giving **24 or more hours** to our system to see improved recommendations.\\n\\nIf the pageview count on our [Lab](https://lab.liftigniter.com/) is extremely different from that of your Google Analytics, check out our guide to [Debugging analytics discrepancies](doc:debugging-analytics-discrepancies).\"\n}\n[/block]\nNow that you have setup LiftIgniter, let's start seeing personalized recommendations!\n\nLoad up your webpage including our `beacon` and open up your `internet browser console` to start testing.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2.1 Printing Recommendations\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Getting Recommendations\",\n  \"body\": \"The `fetch` function can be called at most once on each pageview. It should be called exactly once, after all register calls.\\n\\nSeparate `register` calls need to be made for each widget that you wish to show on a given pageview.\"\n}\n[/block]\nCopy-paste the following snippet of code into your console to see recommendations.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Register call to get 100 recommendations for widget 'default-widget'.\\n// Apply a simple callback to print out the JSON response.\\n$p('register', {\\n                  max: 100, // Large number requested so you can see our full range of items\\n                  widget: 'default-widget', // name of widget\\n                  callback: function(resp) {\\n                    console.log(JSON.stringify(resp, null, 2));\\n\\t\\t    \\t\\t\\t\\t\\t\\tconsole.log(\\\"// TEST.\\\");\\n                  }\\n               }\\n);\\n// Execute the registered call.\\n$p('fetch');\",\n      \"language\": \"javascript\",\n      \"name\": \"Register and Fetch\"\n    }\n  ]\n}\n[/block]\nYou can reference what `register` and `fetch` does on the SDK Documentations. You will see the list of recommended items with default `field`. If you would like to tune the output of the recommendations, please check `Checking Data Fields` docs.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0VM6rMpCRHSUTnVx9YhH_Screen%20Shot%202016-01-08%20at%204.54.13%20PM.png\",\n        \"Screen Shot 2016-01-08 at 4.54.13 PM.png\",\n        \"1090\",\n        \"456\",\n        \"#2a25d0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nIf everything worked so far, congratulations!\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"No recommendations are showing up?\",\n  \"body\": \"Below are the three most likely reasons.  <ol>\\n<li>Your webpage is not in a format that LiftIgniter recognizes so it couldn't collect any `Inventory Item` from you. In this case check the documentations on [Inventory](https://liftigniter.readme.io/docs/what-liftigniter-scrapes).</li>\\n<li>You might be loading our JavaScript twice, which causes our tracker to crash with another instance of itself. Please check Google Tag Manager or other means of inserting our script into the site, and make sure that our script is only being loaded once.</li>\\n<li>We are collecting activities but we didn't start accepting you Inventories. In this case, please contact [Support](doc:support). </li>\\n</ol>\"\n}\n[/block]","excerpt":"","slug":"quick-testing-liftigniter","type":"basic","title":"Quick-Testing LiftIgniter"}

Quick-Testing LiftIgniter


[block:callout] { "type": "warning", "title": "Recommendation Quality", "body": "At this point you have integrated our `beacon` to your website. \n\nWe start analyzing your traffic right from the moment we start receiving pageviews, and serve recommendations within 30 minutes. However, we recommend giving **24 or more hours** to our system to see improved recommendations.\n\nIf the pageview count on our [Lab](https://lab.liftigniter.com/) is extremely different from that of your Google Analytics, check out our guide to [Debugging analytics discrepancies](doc:debugging-analytics-discrepancies)." } [/block] Now that you have setup LiftIgniter, let's start seeing personalized recommendations! Load up your webpage including our `beacon` and open up your `internet browser console` to start testing. [block:api-header] { "type": "basic", "title": "2.1 Printing Recommendations" } [/block] [block:callout] { "type": "info", "title": "Getting Recommendations", "body": "The `fetch` function can be called at most once on each pageview. It should be called exactly once, after all register calls.\n\nSeparate `register` calls need to be made for each widget that you wish to show on a given pageview." } [/block] Copy-paste the following snippet of code into your console to see recommendations. [block:code] { "codes": [ { "code": "// Register call to get 100 recommendations for widget 'default-widget'.\n// Apply a simple callback to print out the JSON response.\n$p('register', {\n max: 100, // Large number requested so you can see our full range of items\n widget: 'default-widget', // name of widget\n callback: function(resp) {\n console.log(JSON.stringify(resp, null, 2));\n\t\t \t\t\t\t\t\tconsole.log(\"// TEST.\");\n }\n }\n);\n// Execute the registered call.\n$p('fetch');", "language": "javascript", "name": "Register and Fetch" } ] } [/block] You can reference what `register` and `fetch` does on the SDK Documentations. You will see the list of recommended items with default `field`. If you would like to tune the output of the recommendations, please check `Checking Data Fields` docs. [block:image] { "images": [ { "image": [ "https://files.readme.io/0VM6rMpCRHSUTnVx9YhH_Screen%20Shot%202016-01-08%20at%204.54.13%20PM.png", "Screen Shot 2016-01-08 at 4.54.13 PM.png", "1090", "456", "#2a25d0", "" ] } ] } [/block] If everything worked so far, congratulations! [block:callout] { "type": "info", "title": "No recommendations are showing up?", "body": "Below are the three most likely reasons. <ol>\n<li>Your webpage is not in a format that LiftIgniter recognizes so it couldn't collect any `Inventory Item` from you. In this case check the documentations on [Inventory](https://liftigniter.readme.io/docs/what-liftigniter-scrapes).</li>\n<li>You might be loading our JavaScript twice, which causes our tracker to crash with another instance of itself. Please check Google Tag Manager or other means of inserting our script into the site, and make sure that our script is only being loaded once.</li>\n<li>We are collecting activities but we didn't start accepting you Inventories. In this case, please contact [Support](doc:support). </li>\n</ol>" } [/block]