Using Page Tracker and Embed code in web pages using-page-tracker-and-embed-code-in-web-pages
Page Tracker is a piece of JavaScript code that you include in third-party websites’ code to enable Adobe Analytics to capture usage data around Adobe Experience Manager assets on these websites.
To capture events, such as clicks and so on that are specific to assets, you also include the Embed code in third-party websites’ code.
The following sample code displays how a web page that contains both the Page Tracker code and Embed code looks like:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://localhost:4502/xxxx/etc.clientlibs/dam/clientlibs/sitecatalyst/appmeasurement.js"></script>
<script type="text/javascript" src="http://localhost:4502/xxxx/etc.clientlibs/dam/clientlibs/foundation/assetinsights/pagetracker.js"></script>
<script type="text/javascript">
assetAnalytics.attrTrackable = 'trackable';
assetAnalytics.defaultTrackable = false;
assetAnalytics.attrAssetID = 'aem-asset-id';
assetAnalytics.assetImpressionPollInterval = 200; // interval in milliseconds
assetAnalytics.charsLimitForGET = 2000; // bytes
assetAnalytics.dispatcher.init("assetstesting","xxxx","xxx","list1","eVar3","event8","event7");
</script>
</head>
<body>
<img
src="https://10.41.52.147:4502/xxxx/content/dam/test/abc.jpg"
data-aem-asset-id="aaid:a386f2cd78234becb66bd11575f9452d"
data-trackable=true
onload=assetAnalytics.core.assetLoaded(this)>
<a
href="https://www.adobe.com"
onclick="assetAnalytics.core.assetClicked(this);return false">
<img
src="http://localhost/xxxx/content/dam/test/xyz.jpg"
data-aem-asset-id="aaid:7fa01fce0ebe40268cd6dcf07e2d9cb1"
data-trackable=true
onload=assetAnalytics.core.assetLoaded(this)>
</a>
</body>
</html>
Adding Page Tracker code adding-page-tracker-code
You add the page tracker code within the header section of your website code. The following code snippet displays the Page Tracker code included in a sample web page:
<head>
<script type="text/javascript" src="http://localhost:4502/xxxx/etc.clientlibs/dam/clientlibs/sitecatalyst/appmeasurement.js"></script>
<script type="text/javascript" src="http://localhost:4502/xxxx/etc.clientlibs/dam/clientlibs/foundation/assetinsights/pagetracker.js"></script>
<script type="text/javascript">
assetAnalytics.attrTrackable = 'trackable';
assetAnalytics.defaultTrackable = false;
assetAnalytics.attrAssetID = 'aem-asset-id';
assetAnalytics.assetImpressionPollInterval = 200; // interval in millis
assetAnalytics.charsLimitForGET = 2000; // bytes
assetAnalytics.dispatcher.init("assetstesting","abc.net","bee","list1","eVar3","event8","event7");
</script>
</head>
Adding Embed code adding-embed-code
You add the embed code within the body of your website code. The following code snippet displays the Embed code included in a sample web page:
<body>
<img
src="http://localhost:4502/xxxx/content/dam/test/xyz.jpg"
data-aem-asset-id="aaid:a386f2cd78234becb66bd11575f9452d"
data-trackable=true
onload=assetAnalytics.core.assetLoaded(this)>
<a
href="https://www.adobe.com"
onclick="assetAnalytics.core.assetClicked(this);return false">
<img
src="http://localhost:4502/xxxx/content/dam/test/xyz.jpg"
data-aem-asset-id="aaid:7fa01fce0ebe40268cd6dcf07e2d9cb1"
data-trackable=true
onload=assetAnalytics.core.assetLoaded(this)>
</a>
</body>