Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[872] Codacy fixes #235

Merged
merged 17 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
lib/countly.min.js
lib/countly.pack.js
plugin/boomerang/boomerang.min.js
examples
test
plugin/ga_adapter
node_modules
coverage
.vscode
.github
.gitignore
Expand Down
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

module.exports = {
/**
* By default, ESLint expects ECMAScript 5 syntax. You can override that setting to enable support
Expand Down Expand Up @@ -210,6 +212,6 @@ module.exports = {
"no-shadow": [
"error"
]
},
}

};
51 changes: 51 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"MD001": true,
"MD002": false,
"MD003": true,
"MD004": true,
"MD005": true,
"MD006": true,
"MD007": { "indent": 2 },
"MD009": false,
"MD010": false,
"MD011": true,
"MD012": { "maximum": 1 },
"MD013": { "line_length": 300 },
"MD014": false,
"MD018": true,
"MD019": true,
"MD020": true,
"MD021": true,
"MD022": false,
"MD023": true,
"MD024": true,
"MD025": true,
"MD026": true,
"MD027": true,
"MD028": true,
"MD029": true,
"MD030": true,
"MD031": true,
"MD032": false,
"MD033": false,
"MD034": false,
"MD035": true,
"MD036": true,
"MD037": true,
"MD038": true,
"MD039": true,
"MD040": true,
"MD041": false,
"MD042": true,
"MD043": false,
"MD044": true,
"MD045": true,
"MD046": true,
"MD047": true,
"MD048": true,
"MD049": true,
"MD050": true,
"MD051": true,
"MD052": true,
"MD053": true
}
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
29 changes: 15 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 22.02.4
- Fixed logs that did not obey to the 'debug' flag

## 22.02.3
- Added support for userAgentData
- Now heatmap scroll event is recorded when leaving a view
Expand Down Expand Up @@ -37,28 +38,28 @@

## 21.11.0
- !! Major breaking change !! Rating and Feedback widgets now require 'star-rating' or 'feedback' consent exclusively, according to their type, instead of both:
- `present_feedback_widget` needs 'feedback' consent only
- `get_available_feedback_widgets` needs 'feedback' consent only
- `enable_feedback` needs 'star-rating' consent only
- `show_feedback_popup` needs 'star-rating' consent only
- `initialize_feedback_popups` needs 'star-rating' consent only
- `report_feedback` needs 'star-rating' consent only
- `present_feedback_widget` needs 'feedback' consent only
- `get_available_feedback_widgets` needs 'feedback' consent only
- `enable_feedback` needs 'star-rating' consent only
- `show_feedback_popup` needs 'star-rating' consent only
- `initialize_feedback_popups` needs 'star-rating' consent only
- `report_feedback` needs 'star-rating' consent only
- !! Major breaking change !! Enabling offline mode or changing device ID without merging will now clear the current consent. Consent has to be given again after performing this action.
- ! Minor breaking change ! 'change_id' will now not accept invalid device ID values. It will now reject null, undefined, values that are not of the type string and empty string values.
- ! Minor breaking change ! Multiple values now have a default limit adjustable at initialization:
- Maximum size of all string keys is now 128 characters by default.
- Maximum size of all values in key-value pairs is now 256 characters by default.
- Maximum amount of segmentation in one event is mow 30 key-value pairs by default.
- Maximum amount of breadcrumbs that can be recorded at once is now 100 by default.
- Maximum stack trace lines per thread is now 30 by default.
- Maximum stack trace line length is now 200 by default.
- Maximum size of all string keys is now 128 characters by default.
- Maximum size of all values in key-value pairs is now 256 characters by default.
- Maximum amount of segmentation in one event is mow 30 key-value pairs by default.
- Maximum amount of breadcrumbs that can be recorded at once is now 100 by default.
- Maximum stack trace lines per thread is now 30 by default.
- Maximum stack trace line length is now 200 by default.
- Bug Fix - Fixed a bug where duration counter/timer was not paused even when the browser was out of focus
- Deprecating `report_feedback`, now it redirects to `recordRatingWidgetWithID`
- Deprecating `show_feedback_popup`, now it redirects to `presentRatingWidgetWithID`
- Deprecating `initialize_feedback_popups`, now it redirects to `initializeRatingWidgets`
- Deprecating `enable_feedback`, now it redirects to `enableRatingWidgets`
- Deprecating `report_conversion`, now it redirects to `recordDirectAttribution`
- When recording internal events with 'add_event', the respective feature consent will now be checked instead of the 'events' consent.
- When recording internal events with 'add_event', the respective feature consent will now be checked instead of the 'events' consent.
- Increased the default max event batch size to 100.
- Automatic orientation tracking is now enabled by default. It can be turned off during init.
- Device ID can now be changed when no consent is given
Expand Down Expand Up @@ -150,7 +151,7 @@

## 18.08.2
- Important Fix for regenerated device_id
- Update to this version if you use 18.08 or 18.08.1.
- Update to this version if you use 18.08 or 18.08.1.
- Fixed storing none json data
- Widgets params changed as popups and back-compatibility provided.

Expand Down
30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Countly Web SDK
# Countly Web SDK
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/79582b7ee7ca4021a3950376402fac00)](https://www.codacy.com/gh/Countly/countly-sdk-web/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Countly/countly-sdk-web&utm_campaign=Badge_Grade) [![npm version](https://badge.fury.io/js/countly-sdk-web.svg)](https://badge.fury.io/js/countly-sdk-web) [![](https://data.jsdelivr.com/v1/package/npm/countly-sdk-web/badge)](https://www.jsdelivr.com/package/npm/countly-sdk-web)

## What is Countly?
Expand All @@ -10,24 +10,21 @@ Track, measure, and take action - all without leaving Countly.
* **Questions?** [Ask in our Community forum](https://support.count.ly/hc/en-us/community/topics)

## Implementing Countly SDK in your web pages

There are 3 ways to get Countly SDK.

### 1. Available with Countly server
Since Countly server 16.02, Countly Web SDK is available in your Countly server installation in `countly/frontend/express/public/sdk/web/countly.min.js` which should be available through URL as `https://yourserver.com/sdk/web/countly.min.js`

### 2. Installation using package managers

bower install countly-sdk-web
or

npm install countly-sdk-web
or

yarn add countly-sdk-web

### 3. Use a CDN (content delivery network)

### 3. Use a CDN (content delivery network)
Countly web SDK is available on CDNJS. Use either

[https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/22.02.4/countly.min.js](https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/22.02.4/countly.min.js)
Expand All @@ -37,38 +34,33 @@ or
[https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/lib/countly.min.js](https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/lib/countly.min.js)

## How to use Countly Web SDK?

Link to the script and call helper methods based on what you want to track: sessions, views, clicks, custom events, user data, etc. and for much more information check out our documentation at [https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-](https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-)

You can reach minimal integration info for your website from here [https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#minimal-setup](https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#minimal-setup)

Countly Web SDK has JSDoc3 compatible comments and you can generate documentation by running `npm run-script docs` or access online version at [https://countly.github.io/countly-sdk-web/](https://countly.github.io/countly-sdk-web/)

## Security

Security is very important to us. If you discover any issue regarding security, please disclose the information responsibly by sending an email to security@count.ly and **not by creating a GitHub issue**.

## Other Github resources
Check Countly Community Edition source code here:

Check Countly Community Edition source code here:

- [Countly Server](https://github.com/Countly/countly-server)
* [Countly Server](https://github.com/Countly/countly-server)

There are also other Countly SDK repositories below:

- [Countly iOS SDK](https://github.com/Countly/countly-sdk-ios)
- [Countly Android SDK](https://github.com/Countly/countly-sdk-android)
- [Countly Windows Phone SDK](https://github.com/Countly/countly-sdk-windows-phone)
- [Countly Appcelerator Titanium SDK](https://github.com/euforic/Titanium-Count.ly) (Community supported)
- [Countly Unity3D SDK](https://github.com/Countly/countly-sdk-unity) (Community supported)
* [Countly iOS SDK](https://github.com/Countly/countly-sdk-ios)
* [Countly Android SDK](https://github.com/Countly/countly-sdk-android)
* [Countly Windows Phone SDK](https://github.com/Countly/countly-sdk-windows-phone)
* [Countly Appcelerator Titanium SDK](https://github.com/euforic/Titanium-Count.ly) (Community supported)
* [Countly Unity3D SDK](https://github.com/Countly/countly-sdk-unity) (Community supported)

## How can I help you with your efforts?

Glad you asked. We need ideas, feedbacks and constructive comments. All your suggestions will be taken care with upmost importance. We are on [Twitter](http://twitter.com/gocountly) and [Facebook](https://www.facebook.com/Countly) if you would like to keep up with our fast progress!

## Badges

If you like Countly, [why not use one of our badges](https://count.ly/brand-assets) and give a link back to us, so others know about this wonderful platform?
If you like Countly, [why not use one of our badges](https://count.ly/brand-assets) and give a link back to us, so others know about this wonderful platform?

<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/dark.svg?v2" alt="Countly - Product Analytics" /></a>

Expand All @@ -79,8 +71,6 @@ If you like Countly, [why not use one of our badges](https://count.ly/brand-asse
<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/light.svg" alt="Countly - Product Analytics" /></a>

## Support

For a public community support page, visit [https://support.count.ly/hc/en-us/community/topics](https://support.count.ly/hc/en-us/community/topics "Countly Community Forum").

[![NPM](https://nodei.co/npm/countly-sdk-web.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/countly-sdk-web/)

6 changes: 4 additions & 2 deletions cypress/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ module.exports = {
"cypress/assertion-before-screenshot": "warn",
"cypress/no-force": "warn",
"cypress/no-async-tests": "error",
"cypress/no-pause": "error"
"cypress/no-pause": "error",
"comma-dangle": ["error", "never"],
"no-multiple-empty-lines": [2, { max: 1, maxEOF: 0 }]
},
env: {
"cypress/globals": true
},
extends: [
"plugin:cypress/recommended",
"plugin:chai-friendly/recommended"
],
]
};
24 changes: 12 additions & 12 deletions cypress/integration/consents.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,44 @@ const eventArray = [
key: "a",
count: 1,
segmentation: {
1: "1",
},
1: "1"
}
},
// rest can be internal events
{
key: "[CLY]_view",
count: 2,
segmentation: {
2: "2",
},
2: "2"
}
},
{
key: "[CLY]_nps",
count: 3,
segmentation: {
3: "3",
},
3: "3"
}
},
{
key: "[CLY]_survey",
count: 4,
segmentation: {
4: "4",
},
4: "4"
}
},
{
key: "[CLY]_star_rating",
count: 5,
segmentation: {
5: "5",
},
5: "5"
}
},
{
key: "[CLY]_orientation",
count: 6,
segmentation: {
6: "6",
},
6: "6"
}
}
];
// event adding loop
Expand Down
4 changes: 1 addition & 3 deletions cypress/integration/device_id.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ function checkRequestsForT(queue, expectedInternalType) {
}
}


/**
*device ID type:
*0 - device ID was set by the developer during init
Expand All @@ -129,7 +128,7 @@ var DeviceIdTypeInternalEnumsTest = {
DEVELOPER_SUPPLIED: 0,
SDK_GENERATED: 1,
TEMPORARY_ID: 2,
URL_PROVIDED: 3,
URL_PROVIDED: 3
};
describe("Device Id tests during first init", ()=>{
// sdk is initialized w/o custom device id, w/o offline mode, w/o utm device id
Expand Down Expand Up @@ -1082,4 +1081,3 @@ describe("Device Id tests during first init", ()=>{
});
});
});

8 changes: 4 additions & 4 deletions cypress/integration/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ const eventObj = {
dur: 1000,
segmentation: {
app_version: "1.0",
country: "Tahiti",
},
country: "Tahiti"
}
};
// a timed event object
const timedEventObj = {
key: "timed",
count: 1,
segmentation: {
app_version: "1.0",
country: "Tahiti",
},
country: "Tahiti"
}
};

describe("Events tests ", () => {
Expand Down
Loading