{"id":19303485,"url":"https://github.com/matthewcallis/wildberry-princess","last_synced_at":"2025-07-03T22:05:35.243Z","repository":{"id":28171500,"uuid":"31672784","full_name":"MatthewCallis/wildberry-princess","owner":"MatthewCallis","description":"JavaScript library for abstracting out Google Analytics (analytics.js) and Kissmetrics.","archived":false,"fork":false,"pushed_at":"2022-12-08T09:37:42.000Z","size":1184,"stargazers_count":4,"open_issues_count":13,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T22:05:02.434Z","etag":null,"topics":["analytics","fullstory","google-analytics","javascript-library","kissmetrics","segment"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatthewCallis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-04T18:28:11.000Z","updated_at":"2019-07-25T23:34:31.000Z","dependencies_parsed_at":"2023-01-14T08:16:58.496Z","dependency_job_id":null,"html_url":"https://github.com/MatthewCallis/wildberry-princess","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/MatthewCallis/wildberry-princess","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Fwildberry-princess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Fwildberry-princess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Fwildberry-princess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Fwildberry-princess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatthewCallis","download_url":"https://codeload.github.com/MatthewCallis/wildberry-princess/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewCallis%2Fwildberry-princess/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263410762,"owners_count":23462297,"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":["analytics","fullstory","google-analytics","javascript-library","kissmetrics","segment"],"created_at":"2024-11-09T23:26:31.336Z","updated_at":"2025-07-03T22:05:35.190Z","avatar_url":"https://github.com/MatthewCallis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wildberry Princess\n\n[![Build Status](https://travis-ci.org/MatthewCallis/wildberry-princess.svg)](https://travis-ci.org/MatthewCallis/wildberry-princess)\n[![Dependency Status](https://david-dm.org/MatthewCallis/wildberry-princess.svg)](https://david-dm.org/MatthewCallis/wildberry-princess)\n[![devDependency Status](https://david-dm.org/MatthewCallis/wildberry-princess/dev-status.svg?style=flat)](https://david-dm.org/MatthewCallis/wildberry-princess#info=devDependencies)\n[![Test Coverage](https://codeclimate.com/github/MatthewCallis/wildberry-princess/badges/coverage.svg)](https://codeclimate.com/github/MatthewCallis/wildberry-princess)\n[![Coverage Status](https://coveralls.io/repos/MatthewCallis/wildberry-princess/badge.svg?branch=master)](https://coveralls.io/r/MatthewCallis/wildberry-princess?branch=master)\n\n![Wildberry Princess](https://raw.githubusercontent.com/MatthewCallis/wildberry-princess/master/wildberry-princess.png)\n\n_-- \"I found this note stabbed to my door! ... man.\"_\n\nWildberry Princess is a JavaScript library for abstracting out Google Analytics (analytics.js), KissMetrics, Segment.io, FullStory, Customer.io and perhaps other analytics platforms in the future.\n\n## Usage\n\n```javascript\n// Google Analytics initialized somewhere...\n// Kissmetrics initialized somewhere...\n// Segment.io initialized somewhere...\n// FullStory initialized somewhere...\n// Customer.io initialized somewhere...\n\n// Setup\nconst analytics = new WildberryPrincess({\n  useGoogleAnalytics: true,\n  useKissMetrics: false,\n});\n\n// Set dimensions and users.\nif (current_user_id != null) {\n  analytics.identify({ id: current_user_id, name: 'Name', email: 'email@domain.tld' });\n}\n\nif (app_id != null) {\n  analytics.set('dimension1', app_id);\n}\n\n// Track user actions, specifically clicks, where the label is the text content (button, div, tab, etc.) or form input name (input, select, textarea).\n// analytics.trackUserActions(selector, category, action, label, value)\nanalytics.trackUserActions('button', 'Button');\nanalytics.trackUserActions('input, select, textarea', 'Form Input');\nanalytics.trackUserActions('tab', 'Tab');\n\n// Send events anywhere, like Backbone model actions.\n// analytics.trackEvent(category, action, label, value)\nanalytics.trackEvent('Model', 'Destroy', this.constructorName);\n\n// Track page views. Currently\n// NOTE: KissMetrics is not included here to avoid event bloat 🤑\napptentive.analytics.trackPageView('/fake-page', 'A Cool Fake Title');\n\n// Send eCommerce data.\nconst transaction_id = `${this.model.id}_${Date.now()}`;\nconst transaction = {\n  id: transaction_id,\n  affiliation: 'Candy Kingdom',\n  revenue: price,\n  shipping: '0',\n  tax: '0',\n};\nconst item = {\n  id: transaction_id,\n  name,\n  category,\n  price,\n  quantity: 1,\n};\n\nanalytics.trackEcommerce('clear');\nanalytics.trackEcommerce('addTransaction', transaction);\nanalytics.trackEcommerce('addItem', item);\nanalytics.trackEcommerce('send');\n```\n\nFor more advanced use, please refer to the source.\n\n### Testing\n\n```shell\nnpm run lint\nnpm run make\nnpm run test\nnpm run report\nnpm run make-dist-min\n```\n\n## Useful Reading\n\n### Google Analytics\n- [Analytics.js Field Reference](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference)\n- [Cookies and User Identification](https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id)\n- [Custom Dimensions and Metrics](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets)\n- [Event Tracking](https://developers.google.com/analytics/devguides/collection/analyticsjs/events)\n\n### Segment.io\n- [Track (Google Analytics)](https://segment.com/docs/integrations/google-analytics/#track)\n- [Track (Segment.io)](https://segment.com/docs/sources/website/analytics.js/#track)\n- [Identify](https://segment.com/docs/spec/identify/)\n\n### Customer.io\n\n- [Javascript API](https://customer.io/docs/api/javascript.html)\n\n# Contributors\n\n- [Owen Kim](https://github.com/owenkim) - Segment.io Support\n- [Democritos Tsellos](https://github.com/dtsellos03) - FullStory Custom Fields\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n![It's gunna be so flippin' awesome!](https://raw.githubusercontent.com/MatthewCallis/HotDogPrincess/master/awesome.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewcallis%2Fwildberry-princess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthewcallis%2Fwildberry-princess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewcallis%2Fwildberry-princess/lists"}