{"_id":"59dd5abd80dd65003a375779","project":"560c93ad7e9b9d0d00ca81a2","version":{"_id":"560c93ae7e9b9d0d00ca81a5","project":"560c93ad7e9b9d0d00ca81a2","__v":9,"createdAt":"2015-10-01T02:00:14.709Z","releaseDate":"2015-10-01T02:00:14.709Z","categories":["560c93af7e9b9d0d00ca81a6","560c9d9399bb5a0d0044f220","560d76d899bb5a0d0044f307","560d76ee1ec45619006069ed","560d86e099bb5a0d0044f32e","560dba80373c0e0d0024ff3b","57c722ecdf19130e001fba5d","57c743d1b6f94a2200659903","58995ec083f743190077bbe2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"560c93af7e9b9d0d00ca81a6","version":"560c93ae7e9b9d0d00ca81a5","__v":1,"pages":["560c93b07e9b9d0d00ca81a8"],"project":"560c93ad7e9b9d0d00ca81a2","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-10-01T02:00:15.249Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"user":"560c92f2ac2859170013faa3","githubsync":"","__v":0,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-10-10T23:41:49.230Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Imported data cannot be deleted!\",\n  \"body\": \"Once you import data, it cannot be deleted.  We recommend that you set up a new project for testing prior to importing you data into production.  You can set up a new project on paid plans by clicking on your avatar on the top right of the Dashboard and clicking the \\\"New Project\\\" button.\"\n}\n[/block]\n**It is important to note**, importing is only useful when capturing events that were missed once Attribution app was installed. Once Attribution app is properly installed importing will be completely unnecessary. \n\nThings that cannot be imported are as follows:\n1. Visitor data \n2. Links or UTM parameters\n\nBelow we will discuss how to import historical data into Attribution app:\n\nFirst, use any server-side library, which send requests in batches to improve performance. Once you have data to import, follow the steps below:\n\n1. Export or collect the data to be imported.\n\n2. Send your data to the appropriate endpoints\n\nUse: [/track](https://docs.attributionapp.com/docs/track) for page views and custom events\n\nUse: [/identify](https://docs.attributionapp.com/docs/identify-1) for loading or updating user information.\n\nThere are a few rules to keep in mind when importing:\n\n1. When importing it is imperative that every event or page view has either \"cookie_id\" or \"user_id\" set; otherwise Attribution app will not be able to track the event. \n\n2. You cannot use Attribution.track('Loaded a page') as this is reserved and equal to Attribution.page(). Any other name will be considered a custom event.\n\n3. The \"timestamp\" property uses the ISO8601 format.  It is critical that you set this properly for the time/date that the event occurred.\n\nExample of page view payload:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"cookie_id\\\": \\\"23adfd82-aa0f-8383-a756-24f2a7a4c895\\\",\\n  \\\"event\\\": \\\"Loaded a Page\\\",\\n  \\\"properties\\\": {\\n    \\\"path\\\": \\\"/collections/mens-bottoms-sweatpants\\\",\\n    \\\"referrer\\\": \\\"https://www.domain.com/cart\\\",\\n    \\\"search\\\": \\\"\\\",\\n    \\\"title\\\": \\\"Mens Bottoms Sweatpants\\\".\\n    \\\"url\\\": \\\"https://www.domain.com/collections/mens-bottoms-sweatpants\\\"\\n  },\\n  \\\"timestamp\\\": \\\"2015-12-12T19:11:01.249Z\\\",\\n  \\\"user_id\\\": null\\n}\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\nExample of custom event payload:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"cookie_id\\\": null,\\n  \\\"event\\\": \\\"Order Paid\\\",\\n  \\\"properties\\\": {\\n    \\\"revenue\\\": \\\"59.99\\\"\\n  },\\n  \\\"timestamp\\\": \\\"2015-12-14T19:09:17.542Z\\\",\\n  \\\"user_id\\\": 12345\\n}\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nIdentify calls are not tied to a timestamp and can be sent anytime you want to create or update a record. However, you should call identify() anytime a user signs up or signs in so that we can us it to bind anonymous traffic with known traffic.","excerpt":"","slug":"importing-historical-data-into-attribution","type":"basic","title":"Importing Historical Data Into Attribution app"}

Importing Historical Data Into Attribution app


[block:callout] { "type": "danger", "title": "Imported data cannot be deleted!", "body": "Once you import data, it cannot be deleted. We recommend that you set up a new project for testing prior to importing you data into production. You can set up a new project on paid plans by clicking on your avatar on the top right of the Dashboard and clicking the \"New Project\" button." } [/block] **It is important to note**, importing is only useful when capturing events that were missed once Attribution app was installed. Once Attribution app is properly installed importing will be completely unnecessary. Things that cannot be imported are as follows: 1. Visitor data 2. Links or UTM parameters Below we will discuss how to import historical data into Attribution app: First, use any server-side library, which send requests in batches to improve performance. Once you have data to import, follow the steps below: 1. Export or collect the data to be imported. 2. Send your data to the appropriate endpoints Use: [/track](https://docs.attributionapp.com/docs/track) for page views and custom events Use: [/identify](https://docs.attributionapp.com/docs/identify-1) for loading or updating user information. There are a few rules to keep in mind when importing: 1. When importing it is imperative that every event or page view has either "cookie_id" or "user_id" set; otherwise Attribution app will not be able to track the event. 2. You cannot use Attribution.track('Loaded a page') as this is reserved and equal to Attribution.page(). Any other name will be considered a custom event. 3. The "timestamp" property uses the ISO8601 format. It is critical that you set this properly for the time/date that the event occurred. Example of page view payload: [block:code] { "codes": [ { "code": "{\n \"cookie_id\": \"23adfd82-aa0f-8383-a756-24f2a7a4c895\",\n \"event\": \"Loaded a Page\",\n \"properties\": {\n \"path\": \"/collections/mens-bottoms-sweatpants\",\n \"referrer\": \"https://www.domain.com/cart\",\n \"search\": \"\",\n \"title\": \"Mens Bottoms Sweatpants\".\n \"url\": \"https://www.domain.com/collections/mens-bottoms-sweatpants\"\n },\n \"timestamp\": \"2015-12-12T19:11:01.249Z\",\n \"user_id\": null\n}", "language": "text" } ] } [/block] Example of custom event payload: [block:code] { "codes": [ { "code": "{\n \"cookie_id\": null,\n \"event\": \"Order Paid\",\n \"properties\": {\n \"revenue\": \"59.99\"\n },\n \"timestamp\": \"2015-12-14T19:09:17.542Z\",\n \"user_id\": 12345\n}", "language": "text" } ] } [/block] Identify calls are not tied to a timestamp and can be sent anytime you want to create or update a record. However, you should call identify() anytime a user signs up or signs in so that we can us it to bind anonymous traffic with known traffic.