{"_id":"54c7a9d356f4ff0d00aaabe3","version":{"_id":"53844558a43e08da4677be12","__v":8,"project":"53844557a43e08da4677be0e","createdAt":"2014-05-27T07:57:12.136Z","releaseDate":"2014-05-27T07:57:12.136Z","categories":["53844558a43e08da4677be13","538619e1ef91f96d49aa1a0b","541e82877eb16bb64f83c0ca","5445a073c3eb3808000c76b2","5445a098c3eb3808000c76b3","54bb05ab522f03150054d9e8","54bb05cf9741c81500078f73","55b7d0e5568be2230092bb92"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"false","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"54bb05ab522f03150054d9e8","project":"53844557a43e08da4677be0e","version":"53844558a43e08da4677be12","__v":4,"pages":["54bc9262e40d150c00d7f92e","54bdeb83445a490c00f41398","54c7a9d356f4ff0d00aaabe3","54f168f5c3b80e1900b1eb1b"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-01-18T01:00:27.133Z","from_sync":false,"order":3,"slug":"3rd-party-integrations","title":"3rd Party Integrations"},"user":"5384345d90c19d5e43a8170c","project":"53844557a43e08da4677be0e","__v":11,"updates":["555f995014d68e0d00966573"],"next":{"pages":[],"description":""},"createdAt":"2015-01-27T15:08:03.397Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Segment is a very powerful way to ship event data from your application to a wide range of analytics and marketing tools - including Knowtify. With our Segment integration, Knowtify is the easiest way to trigger engagement messaging - both in-app and via email - through your Segment integration. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Setting up your Segment integration\"\n}\n[/block]\nIf you have your application's event data integrated via [Segment](http://segment.com), you can start shipping that data to Knowtify immediately. \n\nTo connect your Segment account to Knowtify, all you will need is your Knowtify [API Token](http://www.knowtify.io/settings) (not your Public Token).\n\n1) Login to your Segment account and find our integrations page [here](https://segment.com/knowtify/integration/integrations#knowtify/utm_source=partners&utm_medium=setup&utm_campaign=knowtify.io). \n2) Plug in your Knowtify API Token.\n3) Save and you're done!\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Identify Events\"\n}\n[/block]\nWhenever you send an identify event to Segment it will either (a) create a contact in Knowtify (if that contact doesn't already exist); or (b) update a contact in Knowtify (if that contact already does exist). All of the properties associated with the Identify event will get added as contact properties in Knowtify.\n\nIt is very important that Knowtify receives an .identify call for a user BEFORE receiving a .track call for that user or else we don't know how to match the user id attached to the .track event with an actual user. \n\nIt's also essential that every .identify call contain an email address for a user. We use email addresses to identify users in Knowtify, so we need an email address for every user in order to create a contact record for that user. Once that user is created with an initial .identify call, we will match that user based on his/her Segment id in future .track calls.   \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Track Events\"\n}\n[/block]\nThree things happen when you ship .track events through Segment to Knowtify. \n\nFor example, you might send a .track event that looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"analytics.track('new_job_request', {\\n        category: 'Action',\\n        requester_name: 'Sally Knowne',\\n        job_name: 'Babysitting'\\n      });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nIn this case, Knowtify will:\n\n1. Create and increment a data point on the Contact record associated with this event called {new_job_request}. Every time this event is triggered for a user, this data point will increment by 1. You will be able to use this data point to segment your users and message triggers. For example, you will be able to create a rule that targets only users who have triggered this event more than 0 times....or who have triggered it less than 3 times...etc.\n2. Create a data point for the last time this event was triggered for each user. You will see this data point on a user record in Knowtify as {new_job_request_last}. You will be able to use this data point to segment your users and message triggers. For example, you will be able to create a rule to target users who have triggered this event in the past 3 days...or who haven't triggered this event in the last 30 days...etc.\n3. Create an object that contains the data shipped with this event. You will see a data point on each user record called {new_job_request_content}. This will be an object that holds all the data associated with the event. In our above example, this would be {\"category\":\"Action\", \"requester_name\":\"Sally Knowne\", \"job_name\":\"Babysitting\"}. This is important data that you will use as data for your notification messages. You will be able to insert {new_job_request_content.requester_name} into your email or in-app template to insert the name of the requester into the notification. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Triggering Notification emails and in-app messages directly from Segment\"\n}\n[/block]\nOne of the major advantages of our Segment integration is how easy we make it to trigger your notification message right from events delivered via Segment. You can be shipping notification emails and in-app messages without having to do any additional work on the engineering side. \n\nTo learn how to ship notifications directly from your Segment integration, you can read these docs:\n\n- [Shipping Notification emails directly from Segment](http://api.knowtify.io/v1.0/docs/transactional-emails-with-segment)\n- [Shipping in-app Notifications directly from Segment](http://api.knowtify.io/docs/inbox-notifications-with-segment) \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Getting Knowtify event data FROM Knowtify to Segement\"\n}\n[/block]\nIf you'd like to send data about your messaging events FROM Knowtify back to Segment in order to use it in another analytics platform, all you will need to do is enter your Segment Write Key here: [http://www.knowtify.io/integrations/segment_email_events](http://www.knowtify.io/integrations/segment_email_events) - you can learn more about this on our [Segment page](https://segment.com/docs/integrations/knowtify/#sending-data-from-knowtify).","excerpt":"Pushing data to Knowtify via Segment","slug":"segmentio","type":"basic","title":"SEGMENT"}

SEGMENT

Pushing data to Knowtify via Segment

Segment is a very powerful way to ship event data from your application to a wide range of analytics and marketing tools - including Knowtify. With our Segment integration, Knowtify is the easiest way to trigger engagement messaging - both in-app and via email - through your Segment integration. [block:api-header] { "type": "basic", "title": "Setting up your Segment integration" } [/block] If you have your application's event data integrated via [Segment](http://segment.com), you can start shipping that data to Knowtify immediately. To connect your Segment account to Knowtify, all you will need is your Knowtify [API Token](http://www.knowtify.io/settings) (not your Public Token). 1) Login to your Segment account and find our integrations page [here](https://segment.com/knowtify/integration/integrations#knowtify/utm_source=partners&utm_medium=setup&utm_campaign=knowtify.io). 2) Plug in your Knowtify API Token. 3) Save and you're done! [block:api-header] { "type": "basic", "title": "Identify Events" } [/block] Whenever you send an identify event to Segment it will either (a) create a contact in Knowtify (if that contact doesn't already exist); or (b) update a contact in Knowtify (if that contact already does exist). All of the properties associated with the Identify event will get added as contact properties in Knowtify. It is very important that Knowtify receives an .identify call for a user BEFORE receiving a .track call for that user or else we don't know how to match the user id attached to the .track event with an actual user. It's also essential that every .identify call contain an email address for a user. We use email addresses to identify users in Knowtify, so we need an email address for every user in order to create a contact record for that user. Once that user is created with an initial .identify call, we will match that user based on his/her Segment id in future .track calls. [block:api-header] { "type": "basic", "title": "Track Events" } [/block] Three things happen when you ship .track events through Segment to Knowtify. For example, you might send a .track event that looks like this: [block:code] { "codes": [ { "code": "analytics.track('new_job_request', {\n category: 'Action',\n requester_name: 'Sally Knowne',\n job_name: 'Babysitting'\n });", "language": "javascript" } ] } [/block] In this case, Knowtify will: 1. Create and increment a data point on the Contact record associated with this event called {new_job_request}. Every time this event is triggered for a user, this data point will increment by 1. You will be able to use this data point to segment your users and message triggers. For example, you will be able to create a rule that targets only users who have triggered this event more than 0 times....or who have triggered it less than 3 times...etc. 2. Create a data point for the last time this event was triggered for each user. You will see this data point on a user record in Knowtify as {new_job_request_last}. You will be able to use this data point to segment your users and message triggers. For example, you will be able to create a rule to target users who have triggered this event in the past 3 days...or who haven't triggered this event in the last 30 days...etc. 3. Create an object that contains the data shipped with this event. You will see a data point on each user record called {new_job_request_content}. This will be an object that holds all the data associated with the event. In our above example, this would be {"category":"Action", "requester_name":"Sally Knowne", "job_name":"Babysitting"}. This is important data that you will use as data for your notification messages. You will be able to insert {new_job_request_content.requester_name} into your email or in-app template to insert the name of the requester into the notification. [block:api-header] { "type": "basic", "title": "Triggering Notification emails and in-app messages directly from Segment" } [/block] One of the major advantages of our Segment integration is how easy we make it to trigger your notification message right from events delivered via Segment. You can be shipping notification emails and in-app messages without having to do any additional work on the engineering side. To learn how to ship notifications directly from your Segment integration, you can read these docs: - [Shipping Notification emails directly from Segment](http://api.knowtify.io/v1.0/docs/transactional-emails-with-segment) - [Shipping in-app Notifications directly from Segment](http://api.knowtify.io/docs/inbox-notifications-with-segment) [block:api-header] { "type": "basic", "title": "Getting Knowtify event data FROM Knowtify to Segement" } [/block] If you'd like to send data about your messaging events FROM Knowtify back to Segment in order to use it in another analytics platform, all you will need to do is enter your Segment Write Key here: [http://www.knowtify.io/integrations/segment_email_events](http://www.knowtify.io/integrations/segment_email_events) - you can learn more about this on our [Segment page](https://segment.com/docs/integrations/knowtify/#sending-data-from-knowtify).