{"__v":6,"_id":"56f168612a85600e00ea3dcb","category":{"__v":5,"_id":"564df317826645210097a890","pages":["564e0de843817f17002a5ecc","564e0e5ea910003500a0ca38","564e19e3bc4e172d00b9534e","56f168612a85600e00ea3dcb","56f17465dbe4cc1700a66a7a"],"project":"564de2dbfe07a81700b5c3a5","version":"564de2dbfe07a81700b5c3a8","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-11-19T16:04:39.832Z","from_sync":false,"order":1,"slug":"javascript","title":"JavaScript"},"parentDoc":null,"project":"564de2dbfe07a81700b5c3a5","user":"564de2b4fe07a81700b5c3a4","version":{"__v":8,"_id":"564de2dbfe07a81700b5c3a8","project":"564de2dbfe07a81700b5c3a5","createdAt":"2015-11-19T14:55:23.838Z","releaseDate":"2015-11-19T14:55:23.837Z","categories":["564de2ddfe07a81700b5c3a9","564df317826645210097a890","564df3217c8f372b00b934df","564e5227c3553e0d003e53ba","5666dac5d784a70d00397bcb","56cd08ddd98d851d00c0c3bd","56e9a50946bfd60e008840a7","5718e37bf8f7de1900683fad"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-22T15:44:33.358Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"Embedly can integrate with 3rd Party Analytics, such as Google Analytics, letting you can track media performance in a way that works for you. While we think our Analytics are pretty awesome, we know that it won't fit with every workflow. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Make sure `platform.js` is installed!\",\n  \"body\": \"Intergrations require platform.js to be installed on the page, you can learn how to install it [here](doc:platformjs)\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\nEmbedly will log 16 different events by default\n[block:parameters]\n{\n  \"data\": {\n    \"0-2\": \"URL\",\n    \"h-0\": \"Type\",\n    \"h-1\": \"Action\",\n    \"h-2\": \"Value\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"Video\",\n    \"1-0\": \"Video\",\n    \"2-0\": \"Video\",\n    \"3-0\": \"Video\",\n    \"4-0\": \"Video\",\n    \"5-0\": \"Video\",\n    \"0-1\": \"Play\",\n    \"1-2\": \"URL\",\n    \"2-2\": \"URL\",\n    \"3-2\": \"URL\",\n    \"4-2\": \"URL\",\n    \"5-2\": \"URL\",\n    \"6-2\": \"URL\",\n    \"5-1\": \"Click\",\n    \"6-0\": \"Article\",\n    \"7-0\": \"Image\",\n    \"8-0\": \"Rich\",\n    \"9-0\": \"Product\",\n    \"10-0\": \"Social\",\n    \"11-0\": \"Social\",\n    \"12-0\": \"Social\",\n    \"13-0\": \"Social\",\n    \"14-0\": \"Social\",\n    \"15-0\": \"Recommend\",\n    \"7-2\": \"URL\",\n    \"8-2\": \"URL\",\n    \"9-2\": \"URL\",\n    \"10-2\": \"URL\",\n    \"11-2\": \"URL\",\n    \"12-2\": \"URL\",\n    \"13-2\": \"URL\",\n    \"14-2\": \"URL\",\n    \"15-2\": \"{FROM URL} {TO URL}\",\n    \"6-1\": \"Click\",\n    \"7-1\": \"Click\",\n    \"8-1\": \"Click\",\n    \"9-1\": \"Click\",\n    \"15-1\": \"Click\",\n    \"10-1\": \"Twitter\",\n    \"11-1\": \"Facebook\",\n    \"12-1\": \"Pinterest\",\n    \"13-1\": \"LinkedIn\",\n    \"14-1\": \"Repeat\",\n    \"1-1\": \"25% Watched\",\n    \"2-1\": \"50% Watched\",\n    \"3-1\": \"75% Watched\",\n    \"4-1\": \"100% Watched\",\n    \"0-3\": \"Video was played.\",\n    \"1-3\": \"25% of the video was watched.\",\n    \"2-3\": \"50% of the video was watched.\",\n    \"3-3\": \"75% of the video was watched.\",\n    \"4-3\": \"100% of the video was watched.\",\n    \"5-3\": \"A user clicked on the Video card, i.e. the provider or author.\",\n    \"6-3\": \"A user clicked on the Article card, i.e. the title or the thumbnail.\",\n    \"7-3\": \"A user clicked on the Image card, i.e. the main image.\",\n    \"8-3\": \"A user clicked on the Rich card. Rich cards are anything that isn't video, but media. i.e. Slideshare and SoundCloud are Rich cards.\",\n    \"9-3\": \"A user clicked on the Product card, i.e. the provider or author.\",\n    \"10-3\": \"A user clicked the Twitter share button on the card.\",\n    \"11-3\": \"A user clicked the Facebook share button on the card.\",\n    \"12-3\": \"A user clicked the Pinterest share button on the card.\",\n    \"13-3\": \"A user clicked the LinkedIn share button on the card.\",\n    \"14-3\": \"A user clicked the Embedly Repeat share button to embed the card elsewhere.\",\n    \"15-3\": \"A user clicked on an Embedly recommendation in the Card. The label is the FROM URL (where the media that the user was watching) and the TO URL (where the User is going)\"\n  },\n  \"cols\": 4,\n  \"rows\": 16\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Google Analytics\"\n}\n[/block]\nEmbedly will log events to [Google Analytics](http://www.google.com/analytics/). The standard format looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window.ga('send', 'event', 'Embedly > ' + type, action, value);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Intercom\"\n}\n[/block]\nEmbedly will log events to [Intercom](https://www.intercom.io/). The standard format looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window.Intercom('trackEvent', 'Embedly > ' + type + ' > ' + action, {'url': value });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Mixpanel\"\n}\n[/block]\nEmbedly will log events to [Mixpanel](https://mixpanel.com/). The standard format looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window.mixpanel.push(\\n  ['track', 'Embedly > ' + type + ' > ' + action, {'url': value }]\\n);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Kissmetrics\"\n}\n[/block]\nEmbedly will log events to [Kissmetrics](https://www.kissmetrics.com/). The standard format looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window._kmq.push(['record', 'Embedly > ' + type + ' > ' + action, {'url': value }]);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Segment\"\n}\n[/block]\nEmbedly will log events to [Segment](https://segment.com). The standard format looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window.analytics.track('Embedly > ' + type + ' > ' + action, {'url': value });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Heap\"\n}\n[/block]\nEmbedly will log events to [Heap](https://heapanalytics.com). The standard format looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window.heap.track('Embedly > ' + type + ' > ' + action, {'url': value });\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Custom\"\n}\n[/block]\nWant to create a custom integration or would like to alter the existing event logging? No problem.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var custom = function(type, action, value){\\n  // Write the JavaScript Needed to track the event.\\n  window.myAnalyticsEngine.track(type, action, value);\\n};\\n\\n// Tell embedly you want to use ga and a custom integration\\nembedly(\\\"defaults\\\", {\\n\\tintegrations: [\\\"google\\\", custom] \\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"Analytics Integrations for tracking media performance","slug":"integrations","type":"basic","title":"Analytics"}

Analytics

Analytics Integrations for tracking media performance

Embedly can integrate with 3rd Party Analytics, such as Google Analytics, letting you can track media performance in a way that works for you. While we think our Analytics are pretty awesome, we know that it won't fit with every workflow. [block:callout] { "type": "info", "title": "Make sure `platform.js` is installed!", "body": "Intergrations require platform.js to be installed on the page, you can learn how to install it [here](doc:platformjs)" } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] Embedly will log 16 different events by default [block:parameters] { "data": { "0-2": "URL", "h-0": "Type", "h-1": "Action", "h-2": "Value", "h-3": "Description", "0-0": "Video", "1-0": "Video", "2-0": "Video", "3-0": "Video", "4-0": "Video", "5-0": "Video", "0-1": "Play", "1-2": "URL", "2-2": "URL", "3-2": "URL", "4-2": "URL", "5-2": "URL", "6-2": "URL", "5-1": "Click", "6-0": "Article", "7-0": "Image", "8-0": "Rich", "9-0": "Product", "10-0": "Social", "11-0": "Social", "12-0": "Social", "13-0": "Social", "14-0": "Social", "15-0": "Recommend", "7-2": "URL", "8-2": "URL", "9-2": "URL", "10-2": "URL", "11-2": "URL", "12-2": "URL", "13-2": "URL", "14-2": "URL", "15-2": "{FROM URL} {TO URL}", "6-1": "Click", "7-1": "Click", "8-1": "Click", "9-1": "Click", "15-1": "Click", "10-1": "Twitter", "11-1": "Facebook", "12-1": "Pinterest", "13-1": "LinkedIn", "14-1": "Repeat", "1-1": "25% Watched", "2-1": "50% Watched", "3-1": "75% Watched", "4-1": "100% Watched", "0-3": "Video was played.", "1-3": "25% of the video was watched.", "2-3": "50% of the video was watched.", "3-3": "75% of the video was watched.", "4-3": "100% of the video was watched.", "5-3": "A user clicked on the Video card, i.e. the provider or author.", "6-3": "A user clicked on the Article card, i.e. the title or the thumbnail.", "7-3": "A user clicked on the Image card, i.e. the main image.", "8-3": "A user clicked on the Rich card. Rich cards are anything that isn't video, but media. i.e. Slideshare and SoundCloud are Rich cards.", "9-3": "A user clicked on the Product card, i.e. the provider or author.", "10-3": "A user clicked the Twitter share button on the card.", "11-3": "A user clicked the Facebook share button on the card.", "12-3": "A user clicked the Pinterest share button on the card.", "13-3": "A user clicked the LinkedIn share button on the card.", "14-3": "A user clicked the Embedly Repeat share button to embed the card elsewhere.", "15-3": "A user clicked on an Embedly recommendation in the Card. The label is the FROM URL (where the media that the user was watching) and the TO URL (where the User is going)" }, "cols": 4, "rows": 16 } [/block] [block:api-header] { "type": "basic", "title": "Google Analytics" } [/block] Embedly will log events to [Google Analytics](http://www.google.com/analytics/). The standard format looks like: [block:code] { "codes": [ { "code": "window.ga('send', 'event', 'Embedly > ' + type, action, value);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Intercom" } [/block] Embedly will log events to [Intercom](https://www.intercom.io/). The standard format looks like: [block:code] { "codes": [ { "code": "window.Intercom('trackEvent', 'Embedly > ' + type + ' > ' + action, {'url': value });", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Mixpanel" } [/block] Embedly will log events to [Mixpanel](https://mixpanel.com/). The standard format looks like: [block:code] { "codes": [ { "code": "window.mixpanel.push(\n ['track', 'Embedly > ' + type + ' > ' + action, {'url': value }]\n);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Kissmetrics" } [/block] Embedly will log events to [Kissmetrics](https://www.kissmetrics.com/). The standard format looks like: [block:code] { "codes": [ { "code": "window._kmq.push(['record', 'Embedly > ' + type + ' > ' + action, {'url': value }]);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Segment" } [/block] Embedly will log events to [Segment](https://segment.com). The standard format looks like: [block:code] { "codes": [ { "code": "window.analytics.track('Embedly > ' + type + ' > ' + action, {'url': value });", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Heap" } [/block] Embedly will log events to [Heap](https://heapanalytics.com). The standard format looks like: [block:code] { "codes": [ { "code": "window.heap.track('Embedly > ' + type + ' > ' + action, {'url': value });", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Custom" } [/block] Want to create a custom integration or would like to alter the existing event logging? No problem. [block:code] { "codes": [ { "code": "var custom = function(type, action, value){\n // Write the JavaScript Needed to track the event.\n window.myAnalyticsEngine.track(type, action, value);\n};\n\n// Tell embedly you want to use ga and a custom integration\nembedly(\"defaults\", {\n\tintegrations: [\"google\", custom] \n});", "language": "javascript" } ] } [/block]