{"id":18320902,"url":"https://github.com/bazaarvoice/api-analytics","last_synced_at":"2026-03-15T19:16:57.220Z","repository":{"id":33578147,"uuid":"37224534","full_name":"bazaarvoice/api-analytics","owner":"bazaarvoice","description":"API Analytics","archived":false,"fork":false,"pushed_at":"2018-10-09T17:57:01.000Z","size":817,"stargazers_count":1,"open_issues_count":5,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-21T13:12:57.554Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazaarvoice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-10T21:50:16.000Z","updated_at":"2020-01-28T10:42:55.000Z","dependencies_parsed_at":"2022-09-12T22:21:46.814Z","dependency_job_id":null,"html_url":"https://github.com/bazaarvoice/api-analytics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fapi-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fapi-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fapi-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fapi-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazaarvoice","download_url":"https://codeload.github.com/bazaarvoice/api-analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411238,"owners_count":20934650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:17:48.322Z","updated_at":"2026-03-15T19:16:52.201Z","avatar_url":"https://github.com/bazaarvoice.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"Bazaarvoice API Analytics starter kit\n================\n\nThe Bazaarvoice API Analytics starter kit is a sample consisting of static HTML, CSS, and js that demonstrates how API users should implement the required analytics tags when using the Bazaarvoice API.\n\nBefore Downloading:\n-------------\n1. Implementing the API Analytics Tags is required according to the [API terms and conditions](http://www.bazaarvoice.com/legal/conversations-api-terms-of-use.html)\n2. Read the [API Analytics tutorial](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel) documentation.  Developers should also be familiar with the [API Terms of Use](http://www.bazaarvoice.com/legal/api-terms-of-use.html).\n3. Install the [Bazaarvoice Analytics Inspector for Chrome](https://chrome.google.com/webstore/detail/bazaarvoice-analytics-ins/olmofcadoappjkcnnhomdlnpmpbleekd).\n4. The code in this GitHub repo is also [hosted on a web server](http://api-analytics-kit.bazaarvoice.com/). Both the [product description page](http://api-analytics-kit.bazaarvoice.com/) and the [conversion page](http://api-analytics-kit.bazaarvoice.com/conversion.html) can be considered working samples of the API Analytics starter kit. Users should interact with the pages with the [Bazaarvoice Analytics Inspector for Chrome](https://chrome.google.com/webstore/detail/bazaarvoice-analytics-ins/olmofcadoappjkcnnhomdlnpmpbleekd) enabled to help understand the implementation.\n5. Realize that the starter kit is meant as a sample. It is static, and by no means optimized for speed and scale. There are no calls made to the Conversations API to get product data. The key/value are hard coded in the js file. The code is provided as a means to help API users better understand API analytics.\n\nWhat is the sample doing?\n-------------------------\nThis tutorial captures a user's actions on the product details page.  Accompanying the code on the product details page, is code associated with the conversion event. Bazaarvoice supports various definitions of conversion, both  non-commercial conversion and traditional e-commerce conversion.  By connecting the user's behavior on the product details page to the conversion page, we are able to track the site conversion rate of those who have interacted with user generated content.\n\nAll this is accomplished by adding code that captures how user's interact with the consumer generated content. User events (e.g. viewing the page, scrolling the page, and interacting with the different web inputs) should all be captured within the site.  Attaching client-side javascript code to these different events is the responsibility of the site developer.\n\nAfter the custom code capturing the different parameters is completed and associated with HTML event, the final step is a simple call using the [Bazaarvoice API Tracker library](http://analytics-static.ugc.bazaarvoice.com/prod/static/latest/bv-analytics.js). This is injected onto the page by the Bazaarvoice scoutfile, which is required. To find out more, contact us at developeradvocate@bazaarvoice.com.\n\nThe tracking code requires 2 arguments:\n\u003cul\u003e\n    \u003cli\u003ethe tag name\u003c/li\u003e\n    \u003cli\u003ean object containing the key/value pairs. \u003c/li\u003e\n\u003c/ul\u003e\n\nThe following samples demonstrate some of the analytic calls:\n```js\n    BV.pixel.trackViewedCGC(InViewData, {\n      minPixels: 100,\n      minTime: 5000,\n      containerId: 'CGC_Container'\n    });\n\n    BV.pixel.trackEvent('Feature', {\n        type: 'Used',\n        name: name,\n        brand: featureObject.brand,\n        productId: featureObject.productId,\n        bvProduct: null,\n        categoryId: featureObject.categoryId,\n        detail1: detail1,\n        detail2: detail2\n    });\n\n    BV.pixel.trackConversion(conversionData);\n    BV.pixel.trackTransaction(transactionData);\n```\n\nThe [bv-analytics.js](http://analytics-static.ugc.bazaarvoice.com/prod/static/latest/bv-analytics.js) file send the analytics data to Bazaarvoice servers after collecting from the product details page and the user defined 'conversion' page.\n\n#### Sample Product Details Page\n\nThe javascript on the [sample product description page](http://api-analytics-kit.bazaarvoice.com/) listens for different events. The API Analytics code executes when they occur. The required analytics tags are required for each Bazaarvoice API instance.\n\n##### [Page View Product](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel/product-display-page-overview)\n\nEach time a product details page is rendered, the transaction analytics tag '[page view product](https://developer.bazaarvoice.com/conversations-api/tutorials/analytics#page-view-product)' is executed. In this sample, the '[page view product](https://github.com/bazaarvoice/api-analytics/blob/master/js/main.js#L51-L53)' is associated with the page load event.  When page load is complete, the analytics code is called and passes an object. The object's key/values pairs are [hard coded](https://github.com/bazaarvoice/api-analytics/blob/master/js/main.js#L2-L14) and are not obtained from a Conversations API call.\n\n___\n\n\n##### [Feature Used in View](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel/product-display-page-overview/featured-used-events)\n\nNot all Product Details Pages have Consumer Generated Content (CGC) within the browser's viewable area when the page is rendered.  Often, users must scroll to view the CGC. As part of the API Analytics requirements, when the CGC comes in view, must also be captured. This is done by calling the transactional analytics tag '[feature used in view](https://github.com/bazaarvoice/api-analytics/blob/master/js/main.js#L46)'.  This object's key/value pairs differs slightly from the previous 'page view product' by:\n1. having additional keys that identify the CGC container Id\n2. allow to specify the minimum pixel height that must be viewed before executing\n3. specifying a time (milliseconds) the CGC container must be viewed before executing\n\n___\n\n##### [Feature Used](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel/product-display-page-overview/featured-used-events)\n\nEvent handlers are also attached to the various CGC inputs. This aims to capture how users interact with the Conversations data. In order to complete this.\n\nIncluded in the sample are:\n1. Clicking \"Show/Hide Filter\"\n2. Selecting an Age or Gender sub-filter\n3. Clicking \"Write a Review\"\n4. Interacting with the \"Sort\"\n5. Expanding/contracting the \"Read more/less\"\n6. Voting if the review was helpful\n7. Reporting the review\n8. Clicking the pagination\n9. Clicking the \"See All\" button\n10. Clicking the \"Staff\" button\n\n___\n\n\n#### Conversion Page\n\nThe [conversion page](http://api-analytics-kit.bazaarvoice.com/conversion.html) simulates a page a user would reach upon completing a purchase. With conversion complete, the conversion analytic tags are executed. Both the '[ConversionTransaction](https://github.com/bazaarvoice/api-analytics/blob/master/js/conversion.js#L32-L33)' and the '[PIIConversionTransaction](https://github.com/bazaarvoice/api-analytics/blob/master/js/conversion.js#L32-L33)' are called in this sample. At a minimim one of the three conversion tags must be included in each Bazaarvoice API instance.\n\n##### [ConversionTransaction](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel/transaction-conversion-overview/ecommerce-transactions)\n\n##### [PIIConversionTransaction](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel/transaction-conversion-overview/non-commerce-conversions)\n\n##### [Non Transactional Conversion](https://developer.bazaarvoice.com/conversations-api/tutorials/bv-pixel/transaction-conversion-overview/non-commerce-conversions)\n\nHosted Sample:\n---------------\nIn addition to providing the starter kit for download, the tutorial is hosted for client interaction.\n\nFirst, download and install the [Bazaarvoice Analytics Inspector for Chrome](https://chrome.google.com/webstore/detail/bazaarvoice-analytics-ins/olmofcadoappjkcnnhomdlnpmpbleekd).  Once install you will see the Analytics Inspector icon in the Chrome browser.\n\n\u003cimg width=30% alt=\"Bazaarvoice Analytics Inspector browser extenstion\" src=\"https://cloud.githubusercontent.com/assets/2584258/11514761/c7948e42-983f-11e5-8b90-a3f724da7475.jpg\"\u003e\n\nNext, visit the product description page [hosted API Analytics solutions](http://api-analytics-kit.bazaarvoice.com/). Open the [Bazaarvoice Analytics Inspector](https://chrome.google.com/webstore/detail/bazaarvoice-analytics-ins/olmofcadoappjkcnnhomdlnpmpbleekd) and interact with the page. The tool documents each time an analytics event is captured and sent to Bazaarvoice. Notice the red counter on the icon.\n\n\u003cimg width=30% alt=\"Bazaarvoice Analytics Inspector browser extenstion\" src=\"https://cloud.githubusercontent.com/assets/2584258/11639298/b2339294-9cf1-11e5-8e5a-2cd59183dd44.jpg\"\u003e\n\nScroll and click different HTML inputs. Notice Feature events being populated. Event handlers are attached to several HTML inputs which in-turn queue the analytics code.\n\n\u003cimg width=40% alt=\"product details page, api analytics inspector\" src=\"https://cloud.githubusercontent.com/assets/2584258/11515432/7e035c6e-9843-11e5-917b-f607973a2297.png\"\u003e\n\nAlso available within the hosted site is a sample [conversion](http://api-analytics-kit.bazaarvoice.com/conversion.html) page. Again open the page in a browser with the [Bazaarvoice Analytics Inspector](https://chrome.google.com/webstore/detail/bazaarvoice-analytics-ins/olmofcadoappjkcnnhomdlnpmpbleekd) open. The analytics on this page are executed on page load. There are several options available for defining and capturing conversion events. Conversion is described in detail in the [conversion analytics tags](https://developer.bazaarvoice.com/apis/conversations/tutorials/analytics#conversion-analytics-tags) section.\n\n\u003cimg width=40% alt=\"conversion page, api analytics inspector\" src=\"https://cloud.githubusercontent.com/assets/2584258/11515431/7e01aaa4-9843-11e5-9b76-3ac6934dbc8a.png\"\u003e\n\nConsole logs are displayed because within the [hosted API Analytics solutions](http://api-analytics-kit.bazaarvoice.com/) the 'environment' variable is set to ['staging'](https://github.com/bazaarvoice/api-analytics/blob/master/js/main.js#L3). This flag is used in the js code to enable console.logs. When the 'environment' flag is set to anything else (including the other accepted value 'production') logging will not occur.\n\nThings to Note\n----------------\nThis sample does not make API calls to retrieve and bind client data. Values that should be obtained from the API are hard coded in the HTML and js files. Comments have been added where the values should be obtained from the API.\n\nThe sample works in conjunction with the [Bazaarvoice Analytics Inspector](https://chrome.google.com/webstore/detail/bazaarvoice-analytics-ins/olmofcadoappjkcnnhomdlnpmpbleekd) to aid clients in making sure the implementation is complete.\n\nIt is required that a Bazaarvoice team member verify the completion of each implementation.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazaarvoice%2Fapi-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazaarvoice%2Fapi-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazaarvoice%2Fapi-analytics/lists"}