{"_id":"57fa656e5ba65a17008b9890","user":"5668fa9755e4b32100935d41","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"},"__v":1,"category":{"_id":"56a17776470ae00d00c30642","version":"5668fab608f90021008e8832","__v":5,"project":"5668fab608f90021008e882f","pages":["56a1827ad847b50d00a27729","56a1831f44f3d80d00a2c3c9","56a18a6244f3d80d00a2c3d3","56a18a83932d7c0d008bf231","56a18d1bd847b50d00a27735"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-22T00:27:34.102Z","from_sync":false,"order":5,"slug":"inventory","title":"Inventory (JavaScript)"},"githubsync":"","parentDoc":null,"project":"5668fab608f90021008e882f","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-09T15:42:38.967Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Support Types\",\n  \"body\": \"LiftIgniter supports the following kinds of field values:<ul>\\n<li>String</li><li>List of strings</li><li>Number</li>\\n</ul>We do not currently accept nested JSON structures for `inventory items`. Any such nested structures will be ignored by us when scraping your inventory.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Requesting additional Fields\"\n}\n[/block]\nYou might want us to return additional information about the items for display in recommendations. For instance, you might want to display an author name, author image, or description field in your recommendation area.\n\nIn order to request extra fields, you need to send us the fields prior to fetching our recommendations with `setRequestFields` from our JavaScript SDK:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$p(\\\"setRequestFields\\\", [\\\"list\\\",\\\"of\\\",\\\"fields\\\",\\\"to\\\",\\\"return\\\"])\",\n      \"language\": \"javascript\",\n      \"name\": \"setRequestFields\"\n    }\n  ]\n}\n[/block]\nSometimes we might have items that don’t contain all the fields you request. If you want us to only return items that contain all the fields you request, you can set this, again, prior to calling fetch with `setRequestFieldAON` from the SDK.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$p(\\\"setRequestFieldsAON\\\", true)\",\n      \"language\": \"javascript\",\n      \"name\": \"setRequestFieldsAON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Setting fields explicitly\"\n}\n[/block]\nIf you don’t see the fields you want, this is because the fields weren’t exposed on the page in a way we understand. You can check what fields we are currently scraping by using our API endpoint [/inventory/:itemId](doc:inventoryid) or using the [Insights Panel](doc:insights-panel) in the Lab.\n\nYou can include the fields in the LiftIgniter JSON object on the HTML of your pages:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script id=\\\"liftigniter-metadata\\\" type=\\\"application/json\\\">\\n{\\n  \\\"genre\\\" : [\\\"comedy\\\",\\\"horror\\\",\\\"tragedy\\\"],\\n  \\\"rating\\\" : 20.1,\\n  \\\"author\\\" : \\\"anonymous\\\"\\n}\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Hiding Item\"\n}\n[/block]\nTo exclude pages from being shown in recommendations, add the following in the head of those pages:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script id=\\\"liftigniter-metadata\\\" type=\\\"application/json\\\">\\n{\\n  ...\\n  \\\"noShow\\\" : \\\"true\\\",\\n  ...\\n}\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"editing-fieldshiding-item","type":"basic","title":"Editing Fields/Hiding Item"}

Editing Fields/Hiding Item


[block:callout] { "type": "info", "title": "Support Types", "body": "LiftIgniter supports the following kinds of field values:<ul>\n<li>String</li><li>List of strings</li><li>Number</li>\n</ul>We do not currently accept nested JSON structures for `inventory items`. Any such nested structures will be ignored by us when scraping your inventory." } [/block] [block:api-header] { "type": "basic", "title": "1. Requesting additional Fields" } [/block] You might want us to return additional information about the items for display in recommendations. For instance, you might want to display an author name, author image, or description field in your recommendation area. In order to request extra fields, you need to send us the fields prior to fetching our recommendations with `setRequestFields` from our JavaScript SDK: [block:code] { "codes": [ { "code": "$p(\"setRequestFields\", [\"list\",\"of\",\"fields\",\"to\",\"return\"])", "language": "javascript", "name": "setRequestFields" } ] } [/block] Sometimes we might have items that don’t contain all the fields you request. If you want us to only return items that contain all the fields you request, you can set this, again, prior to calling fetch with `setRequestFieldAON` from the SDK. [block:code] { "codes": [ { "code": "$p(\"setRequestFieldsAON\", true)", "language": "javascript", "name": "setRequestFieldsAON" } ] } [/block] [block:api-header] { "type": "basic", "title": "2. Setting fields explicitly" } [/block] If you don’t see the fields you want, this is because the fields weren’t exposed on the page in a way we understand. You can check what fields we are currently scraping by using our API endpoint [/inventory/:itemId](doc:inventoryid) or using the [Insights Panel](doc:insights-panel) in the Lab. You can include the fields in the LiftIgniter JSON object on the HTML of your pages: [block:code] { "codes": [ { "code": "<script id=\"liftigniter-metadata\" type=\"application/json\">\n{\n \"genre\" : [\"comedy\",\"horror\",\"tragedy\"],\n \"rating\" : 20.1,\n \"author\" : \"anonymous\"\n}\n</script>", "language": "html" } ] } [/block] [block:api-header] { "type": "basic", "title": "3. Hiding Item" } [/block] To exclude pages from being shown in recommendations, add the following in the head of those pages: [block:code] { "codes": [ { "code": "<script id=\"liftigniter-metadata\" type=\"application/json\">\n{\n ...\n \"noShow\" : \"true\",\n ...\n}\n</script>", "language": "html" } ] } [/block]