{"_id":"59fccde3591add0026c91490","project":"5668fab608f90021008e882f","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"},"category":{"_id":"569742f459a6692d003fad8f","pages":["56974f48d231880d00676e6a","56975101d231880d00676e6c","5697511369393517000c82c8","5697512159a6692d003fada0","569752668560a60d00e2c268","569752898560a60d00e2c26b","569752add231880d00676e70","569752bd8400d52d00dd56ab","569752c769393517000c82cc","56e9cf33fae86b0e00e5394f","56e9cfe2af392b170035f68f"],"project":"5668fab608f90021008e882f","version":"5668fab608f90021008e8832","__v":11,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-01-14T06:40:52.350Z","from_sync":false,"order":1,"slug":"api-integration-rest-api","title":"REST API (For App/Backend)"},"user":"5668fa9755e4b32100935d41","githubsync":"","__v":26,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-11-03T20:13:23.644Z","link_external":false,"link_url":"https://documenter.getpostman.com/view/2166502/liftigniter/7TFGvSV#6b9059f8-ec56-46c3-a39b-517763fa110c","sync_unique":"","hidden":false,"api":{"method":"post","examples":{"codes":[{"language":"curl","code":"curl -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"YOUR_API_KEY\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\n  \"timestamp\" : 1400464843310,\n  \"type\" : \"pageview\",\n  \"url\" : \"http://www.dummydomain.com/a-beautiful-sea.html\",\n  \"userId\" : \"de305d54-75b4-431b-adb2-eb6b9e546013\",\n  \"browsingHistory\" : [\"http://www.dummydomain.com/nice-fruits.html\", \"http://www.dummydomain.com/holiday-resorts.html\",\"http://www.dummydomain.com/a-beautiful-sea.html\"],\n  \"referrer\" : \"http://www.dummydomain.com/holiday-resorts.html\"\n}' https://api.petametrics.com/v1/activity | python -mjson.tool","name":"cURL successful"},{"code":"curl -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"527ccb8c-0f33-47e5-bff8-d9c2bcaef59e\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\n  \"timestamp\" : 1400464843310,\n  \"type\" : \"pageview\",\n  \"url\" : \"http://www.dummydomain.com/a-beautiful-sea.html\",\n  \"userId\" : \"de305d54-75b4-431b-adb2-eb6b9e546013\"\n  \"browsingHistory\" : [\"http://www.dummydomain.com/nice-fruits.html\", \"http://www.dummydomain.com/holiday-resorts.html\",\"http://www.dummydomain.com/a-beautiful-sea.html\"],\n  \"referrer\" : \"http://www.dummydomain.com/holiday-resorts.html\",\n  \"visibleItems\" : [\"http://www.dummydomain.com/hot-balloon.html\", \"http://www.dummydomain.com/cute-ketchup.html\"]\n}' https://api.petametrics.com/v1/activity | python -mjson.tool","name":"cURL failed due to bad JSON","language":"json"},{"name":"cURL successful using x-api-key header","language":"curl","code":"curl -H \"Content-Type: application/json\" -H \"x-api-key: 527ccb8c-0f33-47e5-bff8-d9c2bcaef59e\" -d '{\n  \"timestamp\" : 1400464843310,\n  \"type\" : \"pageview\",\n  \"url\" : \"http://www.dummydomain.com/a-beautiful-sea.html\",\n  \"userId\" : \"de305d54-75b4-431b-adb2-eb6b9e546013\",\n  \"browsingHistory\" : [\"http://www.dummydomain.com/nice-fruits.html\", \"http://www.dummydomain.com/holiday-resorts.html\",\"http://www.dummydomain.com/a-beautiful-sea.html\"],\n  \"referrer\" : \"http://www.dummydomain.com/holiday-resorts.html\",\n  \"visibleItems\" : [\"http://www.dummydomain.com/hot-balloon.html\", \"http://www.dummydomain.com/cute-ketchup.html\"]\n}' https://api.petametrics.com/v1/activity | python -mjson.tool"}]},"settings":"5920771aab009e0f00e61ed4","results":{"codes":[{"status":200,"name":"","code":"{\n    \"status\": \"Ok: Activity successfully recorded\",\n    \"statusCode\": 200\n}\n","language":"json"},{"language":"json","status":400,"name":"","code":"{\n    \"status\": \"Bad Request: Request body must contain valid JSON.\",\n    \"statusCode\": 400\n}\n"}]},"auth":"required","params":[{"_id":"5697552324490c3700170a93","ref":"","in":"body","required":true,"desc":"API key that identifies your organization (note that you can use EITHER this OR the x-api-key header).","default":"","type":"string","name":"apiKey"},{"_id":"5697552324490c3700170a92","ref":"","in":"body","required":false,"desc":"The current epoch timestamp in millisecond format.","default":"","type":"int","name":"timestamp"},{"_id":"5697552324490c3700170a91","ref":"","in":"body","required":false,"desc":"Represents the event type.","default":"","type":"string","name":"type"},{"_id":"5697552324490c3700170a8f","ref":"","in":"body","required":false,"desc":"The page the user was on (or content ID if you are using a different field for ID).","default":"","type":"string","name":"url"},{"_id":"5697552324490c3700170a90","ref":"","in":"body","required":false,"desc":"Unique identifier for the user. UUID format is recommended but any format is accepted.","default":"","type":"string","name":"userId"},{"_id":"5697552324490c3700170a8e","ref":"","in":"body","required":false,"desc":"The page the user came to the page from.","default":"","type":"string","name":"referrer"},{"_id":"594969d564b5f5002690b9a4","ref":"","in":"body","required":false,"desc":"LI or base depending on whether the recommendations are powered by LI or base. We also accept custom sources if you are running an A/B test between more than two algorithm sources.","default":"","type":"string","name":"source"},{"_id":"59e90877a92acd001cfa0997","ref":"","in":"body","required":false,"desc":"The name of the widget that was shown, visible, or clicked on.","default":"","type":"string","name":"widgetName"},{"_id":"5697552324490c3700170a8a","ref":"","in":"body","required":false,"desc":"The name of the widget the user clicked on to arrive at the current pageview.","default":"","type":"string","name":"sourceWidgetName"},{"_id":"5697552324490c3700170a8d","ref":"","in":"body","required":false,"desc":"The list of pages the user has recently visited on your site (deduplicated and sorted from newest to oldest).","default":"","type":"array_string","name":"browsingHistory"},{"_id":"594961f68a76f300263f35bc","ref":"","in":"body","required":false,"desc":"A unique identifier for the pageview. This is helpful if you are sending many different events per pageview. A pageviewId will also allow our system to know, for later requests on the same pageview, the history of recommendations we have already returned, and therefore avoid duplication.","default":"","type":"string","name":"pageviewId"},{"_id":"5697552324490c3700170a8c","ref":"","in":"body","required":false,"desc":"A unique identifier you can send in to identify a single user session.","default":"","type":"string","name":"sessionId"},{"_id":"5697552324490c3700170a8b","ref":"","in":"body","required":false,"desc":"Includes the list of items you are showing as recommendations on the current page.","default":"","type":"array_string","name":"visibleItems"},{"_id":"5697552324490c3700170a87","ref":"","in":"body","required":false,"desc":"User’s IP address.","default":"","type":"string","name":"host"},{"_id":"5697552324490c3700170a86","ref":"","in":"body","required":false,"desc":"User's city.","default":"","type":"string","name":"city"},{"_id":"5697552324490c3700170a85","ref":"","in":"body","required":false,"desc":"User's country.","default":"","type":"string","name":"country"},{"_id":"5697552324490c3700170a84","ref":"","in":"body","required":false,"desc":"User's language.","default":"","type":"string","name":"language"},{"_id":"59a08a94946f0b00370faa81","ref":"","in":"body","required":false,"desc":"is the full user agent string. This is available for web integrations. From this we can extract the user’s browser and operating system.","default":"","type":"string","name":"userAgent"},{"_id":"57f9b95f14f95f0e005797cb","ref":"","in":"body","required":false,"desc":"The URL of the item that was clicked on, in case the type is widget_click","default":"","type":"string","name":"clickUrl"},{"_id":"5920761e31039a0f0008e5ba","ref":"","in":"header","required":false,"desc":"API key that identifies your organization (note that you can use EITHER this OR the apiKey parameter in the body).","default":"","type":"string","name":"x-api-key"}],"url":"/activity"},"isReference":true,"order":2,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Use consistent IDs between activity, inventory and model requests\",\n  \"body\": \"In order for us to relate activity data with the activities and model queries, there are two unique identifiers that need to remain consistent across endpoints.\\n\\n**UserID**:\\nYou need to include the same \\\"userId\\\" value in the activity and in the model queries. If you do so, we will match the userId against the user data store and personalize our recommendations based on that information.\\n\\n**Content URL** (or ID if your account has been modified to use ID instead of URL):\\nWe recommend using the canonical URL as the unique identifier for content (the \\\"url\\\" parameter). This includes the protocol (http vs https) and sub-domain of the item (www. vs m.). Mismatches between Inventory URLs and the URLs sent in activity tracking tend to result in stale recommendations as the system is unable to reconcile which inventory items are performing best in CTR.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Using an ID for your Inventory instead of a URL?\",\n  \"body\": \"If you are using an ID for your inventory items, use the following parameters instead:\\n\\n\\\"url\\\" should be \\\"id\\\".\\n\\\"clickUrl\\\" should be \\\"clickId\\\"\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Event Types\"\n}\n[/block]\nFor most integrations, the user follows a typical website flow - viewing pages, and clicking on links within the recommendation areas. For these, there are four standard activity events that need to be sent to LiftIgniter.\n\n## Standard Events\n1. pageview\n2. widget_shown\n3. widget_visible\n4. widget_click\n\nWe can also track a number of other user interactions, including custom engagement events (e.g. likes and comments), conversions (subscription signups, add to cart, cart purchase) and media interactions (e.g. videos playing and ending).\n\n## Optional Events\n1. User Engagment\n2. Conversion\n3. Media Interaction\n[block:api-header]\n{\n  \"title\": \"Pageviews\"\n}\n[/block]\nThe pageview is the fundamental building block of a user's behavior history. By sending data to us in realtime, LiftIgniter can personalize recommendations based on what the user has previously viewed - including the page they just came from.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"pageview\\\",\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"title\\\": \\\"A Beautiful Sea\\\"\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\" : \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"sourceWidgetName\\\": \\\"default-widget\\\",\\n  \\\"viewType\\\": \\\"new\\\"\\n  \\\"deviceType\\\": \\\"desktop\\\"\\n  \\\"os\\\": \\\"Win64\\\"\\n  \\\"host\\\": \\\"168.0.0.1\\\"\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\"\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\"\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"\\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"pageview\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Widget Shown\"\n}\n[/block]\nWidget_shown events indicate that a set of recommendations were loaded somewhere on the page. They may not necessarily be visible to the user on page load (that is tracked via widget_visible events). This is an important indicator for our algorithms, and also allows us to calculate the Click-Through Rate for each widget and the items within them.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"widget_shown\\\",\\n  \\\"widgetName\\\": \\\"default-widget\\\",\\n  \\\"visibleItems\\\": [list of all recommended items in widget as a JSON array],\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"host\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"widget_shown\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Widget Visible\"\n}\n[/block]\nWidget_visible events indicate that a set of recommended items has been scrolled into the user's viewport. Widget visibility is a very strong indicator for our models, because if a user doesn't click on an item, we know that it was because the recommendations were not interesting to that user, rather than because they did not see them at all.\n\nThe visible_items parameter in widget_visible events should contain only those items that are actually visible to the user. For example, if you have requested 9 items, but only 3 are visible to the user at any one time (e.g. a carousel of items), you would want to send a widget_visible event with only the 3 items listed in visibleItems.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"widget_visible\\\",\\n  \\\"widgetName\\\": \\\"default-widget\\\",\\n  \\\"visibleItems\\\": [list of all recommended items visible to the user in the widget as a JSON array],\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"host\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"widget_visible\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Widget Clicks\"\n}\n[/block]\nThere are two types of click events that can be sent: widget_click and engaged_click.\n\nA *widget_click* is best thought of as a navigational click - the user is simply going from page A to page B. It indicates an interest in the content of page B, and is one of the most powerful signals used by our models. **Widget_click events are required for our integration.**\n\nAn *engaged_click* can be sent if a user then meets a particular engagement threshold on page B. This could be something like playing a video, making a comment on the page, or simply staying on the page for a specific length of time. This provides additional feedback to our models about how Page A and Page B relate to each other, and the strength of that relationship. **Engaged_click events are optional.**\n\nThe main technical challenge with sending engaged_click events is that the user and impression context for the click event must include information about the page the click came from. Therefore, it requires you to store this information either on the client side or on your server.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"widget_click\\\",\\n  \\\"widgetName\\\": \\\"default-widget\\\",\\n  \\\"visibleItems\\\": [list of all recommended items in widget as a JSON array],\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"clickUrl\\\": \\\"http://www.dummydomain.com/a-lovely-beach.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"host\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"widget_click\"\n    },\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"engaged_click\\\",\\n  \\\"widgetName\\\": \\\"default-widget\\\",\\n  \\\"visibleItems\\\": [list of all recommended items in widget as a JSON array],\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"clickUrl\\\": \\\"http://www.dummydomain.com/a-lovely-beach.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"ip\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"engaged_click\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"User Engagement Events - OPTIONAL\"\n}\n[/block]\nEngaged events introduce a new parameter: \"engaged_t\". This field accepts any string value, and can be used to identify the type of positive engagement event that occurred. Engaged events can include:\n- likes\n- comments\n- upvotes\n- scrolling to a particular depth\n\nNegative engagement (e.g. downvoting or disliking a page or item) is not currently tracked by default. If this is an important component of your app or site experience, please contact Support!\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"engaged\\\",\\n  \\\"engaged_t\\\": \\\"like\\\",\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"host\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"engaged\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Conversions - OPTIONAL\"\n}\n[/block]\nConversion events use a new parameter: \"conversion_t\". This field accepts any string value, and can be used to identify the type of conversion event that occurred. Conversion events can include:\n- subscribed to a newsletter\n- added item to cart\n- purchased cart items\n- signed up for an event\n\nIf you start sending conversion events, our models will automatically begin optimizing for increased conversions, in addition to higher CTR.\n\n**For E-commerce**\nIn addition to \"conversion_t\", you can also include \"price\" information. While not enabled by default, we can use that information to further optimize for higher-priced conversions. Please contact Support if you are interested in enabling this!\n\n**A note on attribution:**\nConversion events should be tied back to the widget that contributed to the conversion. In some scenarios (a user clicked on a widget at the beginning of their session, then went through several more pages before converting) the link between widget_click and conversion may be very weak. In others (a user clicked on a product recommendation, added it to cart, and proceeded to purchase) it may be very clear.\n\nIn general, if a widget_click immediately preceded a conversion, we recommend attributing the conversion to that widget. Attribution in other scenarios is a matter of preference - be aware that conversion is a very strong signal, and does affect model optimization!\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"conversion\\\",\\n  \\\"conversion_t\\\": \\\"subscribed\\\",\\n  \\\"widgetName\\\": \\\"default-widget\\\",\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/email-me.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"host\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"conversion\"\n    },\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"conversion\\\",\\n  \\\"conversion_t\\\": \\\"add-to-cart\\\",\\n  \\\"price\\\": 29.99,\\n  \\\"widgetName\\\": \\\"default-widget\\\",\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"ip\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"conversion - e-commerce\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Media Interactions - OPTIONAL\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"play\\\",\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"host\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"play\"\n    },\n    {\n      \"code\": \"curl -H \\\"Content-Type: application/json\\\" -d '{\\n  \\\"apiKey\\\" : \\\"YOUR_API_KEY\\\", // REPLACE WITH YOUR API KEY AND REMOVE THIS COMMENT\\n  \\\"timestamp\\\" : 1400464843310,\\n  \\\"type\\\" : \\\"ended\\\",\\n  \\\"url\\\" : \\\"http://www.dummydomain.com/a-beautiful-sea.html\\\",\\n  \\\"source\\\": \\\"LI\\\" or \\\"base\\\",\\n  \\\"userId\\\" : \\\"de305d54-75b4-431b-adb2-eb6b9e546013\\\",\\n  \\\"referrer\\\": \\\"http://www.dummydomain.com/holiday-resorts.html\\\",\\n  \\\"referrerType\\\": \\\"direct\\\",\\n  \\\"deviceType\\\": \\\"desktop\\\",\\n  \\\"os\\\": \\\"Win64\\\",\\n  \\\"ip\\\": \\\"168.0.0.1\\\",\\n  \\\"userAgent\\\": \\\"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\\\",\\n  \\\"pageviewId\\\": \\\"34219bae-e05d-4c6d-b964-d7d051be7661\\\",\\n  \\\"sessionId\\\": \\\"a95eeafe-d5bf-4064-85c1-eaf5710d67e3\\\"  \\n}' https://api.petametrics.com/v1/activity | python -mjson.tool\",\n      \"language\": \"curl\",\n      \"name\": \"ended\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Consequences of not sending data\",\n  \"body\": \"The more data you send for events, the more efficiently our machine learning system will work, and the more complete the analytics we will be able to report to you.\\n\\nIf there are specific pieces of the data that you are unable to send, we recommend discussing with [Support](doc:support) to understand the impact of the missing data in terms of what metrics will not be available to you, and how it might handicap our recommendation system.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"If you want to send multiple activities together, use the documentation on this page for information on the fields to send in each activity, and use the documentation at [/activity (multiple activities)](doc:activity-1) for how to wrap the information in your POST to the /activity endpoint.\",\n  \"title\": \"Sending Multiple Events At Once\"\n}\n[/block]","excerpt":"","slug":"activity","type":"link","title":"/activity (single activity)"}