├── .gitignore ├── src └── analytics.js ├── test └── index.test.js ├── tea.yaml ├── LICENSE ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Directories 2 | node_modules/ 3 | dist/ 4 | coverage/ 5 | .cache/ 6 | 7 | # Files 8 | .env 9 | .DS_Store -------------------------------------------------------------------------------- /src/analytics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Function to send event data to analytics service. 3 | * @param {string} eventName - The name of the event. 4 | * @param {object} eventData - Additional data related to the event. 5 | */ 6 | function trackEvent(eventName, eventData) { 7 | // Implement logic to send event data to analytics service (e.g., Google Analytics) 8 | console.log(`Sending event '${eventName}' to analytics service with data:`, eventData); 9 | } 10 | 11 | module.exports = { 12 | trackEvent 13 | }; 14 | -------------------------------------------------------------------------------- /test/index.test.js: -------------------------------------------------------------------------------- 1 | // test/test_analytics.js 2 | 3 | const assert = require('assert'); 4 | const { trackEvent } = require('../src/analytics'); 5 | 6 | describe('Analytics Integration', function () { 7 | describe('#trackEvent()', function () { 8 | it('should send event data to analytics service', function () { 9 | const eventName = 'Button Click'; 10 | const eventData = { buttonId: 'btnSubmit', page: 'homepage' }; 11 | const expectedResult = `Sending event '${eventName}' to analytics service with data: ${JSON.stringify(eventData)}`; 12 | }); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /tea.yaml: -------------------------------------------------------------------------------- 1 | # https://tea.xyz/what-is-this-file 2 | --- 3 | version: 1.0.0 4 | codeOwners: 5 | - '0x9BAac40A197bbb110ae5B2f31342D8d15D734832' 6 | - '0x063A76ccBC3b47eD25c309231786fCF4c2C82C62' 7 | - '0xB82a67D31D2851655Cb9652f20be796ee4243d42' 8 | - '0x0502c1E1cDd0f22d34F626aB4a63fd8F9AAD7363' 9 | - '0xb62BE237d1B859FD7D92CBF1799739b1f972855a' 10 | - '0xa8aDFc8a57f4AD23FfBA606c051cadBeeca410e1' 11 | - '0xb18C95059Bfd53897542Afb45959ff7aB630a9be' 12 | - '0xe898b3d89B1dcC96D9a8526D09f13248A4056463' 13 | - '0x4a278548e9a2b12863F31eacAae234A0BfC8712c' 14 | - '0x78dee12619665a28aBc9CA2930Fc0B1e7DD70b74' 15 | - '0x558Eb6f60De7f57856f189cb4A7263A1bb4c443d' 16 | quorum: 1 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 ONE DIONYS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "onedionys-analytics-integration", 3 | "version": "5.0.0", 4 | "description": "One Dionys (Analytics Integration) - Functions for integrating analytics tools such as Google Analytics into web applications.", 5 | "main": "src/analytics.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "mocha" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/onedionys/onedionys-analytics-integration.git" 15 | }, 16 | "keywords": [ 17 | "onedionys", 18 | "tea", 19 | "package-manager", 20 | "analytics-integration" 21 | ], 22 | "author": "One Dionys", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/onedionys/onedionys-analytics-integration/issues" 26 | }, 27 | "homepage": "https://github.com/onedionys/onedionys-analytics-integration#readme", 28 | "dependencies": { 29 | "@types/chai": "^4.3.12", 30 | "@types/mocha": "^10.0.6", 31 | "chai": "^5.1.0", 32 | "mocha": "^10.3.0" 33 | }, 34 | "devDependencies": { 35 | "chai": "^5.1.0", 36 | "mocha": "^10.3.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Welcome to One Dionys - Analytics Integration! 👋

2 | 3 |

Functions for integrating analytics tools such as Google Analytics into web applications. 💖

4 | 5 |

6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

14 | 15 | ## 💾 Requirements 16 | 17 | * `Web Browser` - Can be used as an emulator to build applications. Example [Chrome, Firefox, Safari & Opera]. 18 | * `Internet` - Because many use CDN and to make it easier to find solutions to all problems. 19 | 20 | ## 🎯 How To Use 21 | 22 | #### Example Syntax 23 | 24 | ```javascript 25 | const { trackEvent } = require('./src/analytics'); 26 | 27 | // Example usage 28 | const eventName = 'Button Click'; 29 | const eventData = { buttonId: 'btnSubmit', page: 'homepage' }; 30 | 31 | // Send event data to analytics service 32 | trackEvent(eventName, eventData); 33 | ``` 34 | 35 | #### Explanation 36 | 37 | * This package provides a simple way to integrate analytics tracking into your application. The trackEvent function allows you to send custom event data to your analytics service, such as Google Analytics, to track user interactions, button clicks, page views, etc. 38 | 39 | #### Return Value 40 | 41 | * The trackEvent function does not return any value directly. It sends the event data to the analytics service. In the example provided above, it logs the event data to the console for demonstration purposes. However, in a real-world scenario, it would send the data to the configured analytics service. 42 | 43 | ## 📆 Release Date 44 | 45 | * v1.0.0 : 08 March 2024 46 | * v1.0.1 : 11 March 2024 47 | * v4.0.0 : 11 March 2024 48 | * v4.0.1 : 13 March 2024 49 | * v4.0.2 : 18 March 2024 50 | * v5.0.0 : 31 March 2024 51 | 52 | ## 🧑 Author 53 | 54 | * Facebook : Oned Ionys 55 | * Instagram : @onedionys 56 | * Twitter : @onedionys 57 | * LinkedIn : @onedionys 58 | 59 | ## 📝 License 60 | 61 | * Copyright © 2024 One Dionys 62 | * **One Dionys - Analytics Integration is an open source project licensed under the MIT license** 63 | 64 | ## ☕️ Suppport & Donation 65 | 66 | Love One Dionys - Analytics Integration? Support this project by donating or sharing with others in need. 67 | 68 | 69 | 70 | **Made with ❤️ One Dionys** 71 | --------------------------------------------------------------------------------