CountlyBulkUser object to make it easier to send information about specific user in bulk requests
- Description:
- CountlyBulkUser object to make it easier to send information about specific user in bulk requests
- Source:
Example
var CountlyBulk = require("countly-sdk-nodejs").Bulk;
var server = new CountlyBulk({
app_key: "{YOUR-API-KEY}",
url: "https://API_HOST/",
debug: true
});
//adding requests by user
var user = server.add_user({device_id:"my_device_id"});
Methods
(static) group_features(groupedFeatures)
- Description:
- Modify feature groups for consent management. Allows you to group multiple features under one feature group
- Source:
Examples
Adding all features under one group
user.group_features({all:["sessions","events","views","crashes","attribution","users"]});
//After this call user.add_consent("all") to allow all features
Grouping features
user.group_features({
activity:["sessions","events","views"],
info:["attribution","users"]
});
//After this call user.add_consent("activity") to allow "sessions","events","views"
//or call user.add_consent("info") to allow "attribution","users"
//or call user.add_consent("crashes") to allow some separate feature
Parameters:
Name |
Type |
Description |
groupedFeatures |
object
|
object to define feature name as key and core features as value |
(static) check_consent(feature) → {bool}
- Description:
- Check if consent is given for specific feature (either core feature of from custom feature group)
- Source:
Parameters:
Name |
Type |
Description |
feature |
string
|
name of the feature, possible values, "sessions","events","views","crashes","attribution","users" or customly provided through CountlyBulkUser.group_features |
Returns:
true if consent is given, false if it is not
-
Type
-
bool
(static) add_consent(feature)
- Description:
- Add consent for specific feature, meaning, user allowed to track that data (either core feature of from custom feature group). Add consent before adding any data, or else this data will be ignored, as per not having consent
- Source:
Parameters:
Name |
Type |
Description |
feature |
string
|
array
|
name of the feature, possible values, "sessions","events","views","crashes","attribution","users" or customly provided through CountlyBulkUser.group_features |
(static) remove_consent(feature)
- Description:
- Remove consent for specific feature, meaning, user opted out to track that data (either core feature of from custom feature group)
- Source:
Parameters:
Name |
Type |
Description |
feature |
string
|
array
|
name of the feature, possible values, "sessions","events","views","crashes","attribution","users" or custom provided through CountlyBulkUser.group_features |
(static) remove_consent_internal(feature, enforceConsentUpdate)
- Description:
- Remove consent internally for specific feature,so that a request wont be sent for the operation
- Source:
Parameters:
Name |
Type |
Description |
feature |
string
|
array
|
name of the feature, possible values, "sessions","events","views","crashes","attribution","users" or custom provided through CountlyBulkUser.group_features |
enforceConsentUpdate |
Boolean
|
regulates if a request will be sent to the server or not. If true, removing consents will send a request to the server and if false, consents will be removed without a request |
- Description:
- Source:
Parameters:
Name |
Type |
Description |
metrics |
Object
|
provide Metrics for this user/device, or else will try to collect what's possible
Properties
Name |
Type |
Attributes |
Description |
_os |
string
|
|
name of platform/operating system |
_os_version |
string
|
|
version of platform/operating system |
_device |
string
|
<optional>
|
device name |
_resolution |
string
|
<optional>
|
screen resolution of the device |
_carrier |
string
|
<optional>
|
carrier or operator used for connection |
_density |
string
|
<optional>
|
screen density of the device |
_locale |
string
|
<optional>
|
locale or language of the device in ISO format |
_store |
string
|
<optional>
|
source from where the user/device/installation came from |
|
seconds |
number
|
how long did the session last in seconds |
timestamp |
number
|
timestamp when session started |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Source:
Parameters:
Name |
Type |
Description |
event |
Event
|
Countly Event object
Properties
Name |
Type |
Attributes |
Default |
Description |
key |
string
|
|
|
name or id of the event |
count |
number
|
<optional>
|
1
|
how many times did event occur |
sum |
number
|
<optional>
|
|
sum to report with event (if any) |
dur |
number
|
<optional>
|
|
duration to report with event (if any) |
timestamp |
number
|
<optional>
|
|
timestamp when event occurred |
segmentation |
Object
|
<optional>
|
|
object with segments key /values |
|
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Source:
Parameters:
Name |
Type |
Description |
user |
Object
|
Countly UserDetails object
Properties
Name |
Type |
Attributes |
Description |
name |
string
|
<optional>
|
user's full name |
username |
string
|
<optional>
|
user's username or nickname |
email |
string
|
<optional>
|
user's email address |
organization |
string
|
<optional>
|
user's organization or company |
phone |
string
|
<optional>
|
user's phone number |
picture |
string
|
<optional>
|
url to user's picture |
gender |
string
|
<optional>
|
M value for male and F value for femail |
byear |
number
|
<optional>
|
user's birth year used to calculate current age |
custom |
Object
|
<optional>
|
object with custom key value properties you want to save with user |
|
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
(static) report_conversion(campaign_id, campaign_user_idopt, timestampopt) → {module:lib/countly-bulk-user}
- Description:
- Report user conversion to the server (when you retrieved countly campaign data, for example through Android INSTALL_REFERER intent)
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
campaign_id |
string
|
|
id of campaign, the last part of the countly campaign link |
campaign_user_id |
string
|
<optional>
|
id of user's clicked on campaign link, if you have one or provide null |
timestamp |
number
|
<optional>
|
timestamp of the conversion |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
(static) report_view(view_name, timestamp, duration, viewSegmentsopt) → {module:lib/countly-bulk-user}
- Description:
- Report user accessing specific view in your application
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
view_name |
string
|
|
name of the view or any other view identifier |
timestamp |
number
|
|
when user accessed the view |
duration |
number
|
|
how much did user spent on this view |
viewSegments |
object
|
<optional>
|
optional key value object with segments to report with the view
Properties
Name |
Type |
Attributes |
Description |
platform |
string
|
|
on which platforms/os did user access this view |
landing |
boolean
|
<optional>
|
true if user started using your app with this view |
exit |
boolean
|
<optional>
|
true if user exited your app after this view |
bounce |
boolean
|
<optional>
|
true if user bounced having only one view and without much interaction with the app |
{any} |
boolean
|
<optional>
|
provide any other key value pairs to store with view |
|
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Provide information about user
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
feedback |
Object
|
|
object with feedback properties
Properties
Name |
Type |
Attributes |
Description |
widget_id |
string
|
|
id of the widget in the dashboard |
platform |
string
|
|
user's platform |
app_version |
string
|
|
app's app version |
rating |
number
|
|
user's rating |
contactMe |
boolean
|
<optional>
|
did user give consent to contact him |
email |
string
|
<optional>
|
user's email |
comment |
string
|
<optional>
|
user's comment |
|
timestamp |
number
|
<optional>
|
timestamp when feedback was acquired |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Source:
Parameters:
Name |
Type |
Description |
trace |
Object
|
apm trace object
Properties
Name |
Type |
Attributes |
Description |
type |
string
|
|
device or network |
name |
string
|
|
url or view of the trace |
stz |
number
|
|
start timestamp |
etz |
number
|
|
end timestamp |
app_metrics |
Object
|
|
key/value metrics like duration, to report with trace where value is number |
apm_attr |
Object
|
<optional>
|
object profiling attributes (not yet supported) |
|
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Source:
Parameters:
Name |
Type |
Description |
crash |
Object
|
object containing information about crash and state of device
Properties
Name |
Type |
Attributes |
Description |
_os |
string
|
|
Platform/OS of the device, |
_os_version |
string
|
|
Platform's/OS version |
_manufacture |
string
|
<optional>
|
manufacture of the device |
_device |
string
|
<optional>
|
device model |
_resolution |
string
|
<optional>
|
device resolution |
_app_version |
string
|
|
version of the app that crashed |
_cpu |
string
|
<optional>
|
type of cpu used on device (for ios will be based on device) |
_opengl |
string
|
<optional>
|
version of open gl supported |
_ram_current |
number
|
<optional>
|
used amount of ram at the time of crash in megabytes |
_ram_total |
number
|
<optional>
|
total available amount of ram in megabytes |
_disk_current |
number
|
<optional>
|
used amount of disk space at the time of crash in megabytes |
_disk_total |
number
|
<optional>
|
total amount of disk space in megabytes |
_bat |
number
|
<optional>
|
battery level from 0 to 100 |
_orientation |
string
|
<optional>
|
orientation in which device was held, landscape, portrait, etc |
_root |
boolean
|
<optional>
|
true if device is rooted/jailbroken, false or not provided if not |
_online |
boolean
|
<optional>
|
true if device is connected to the internet (WiFi or 3G), false or not provided if not connected |
_muted |
boolean
|
<optional>
|
true if volume is off, device is in muted state |
_background |
boolean
|
<optional>
|
true if app was in background when it crashed |
_name |
string
|
<optional>
|
identfiiable name of the crash if provided by OS/Platform, else will use first line of stack |
_error |
string
|
|
error stack, can provide multiple separated by blank new lines |
_nonfatal |
boolean
|
<optional>
|
true if handled exception, false or not provided if unhandled crash |
_logs |
string
|
<optional>
|
some additional logs provided, if any |
_run |
number
|
<optional>
|
running time since app start in seconds until crash |
_custom |
string
|
<optional>
|
custom key values to record with crash report, like versions of other libraries and frameworks used, etc. |
|
timestamp |
number
|
when crash happened |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Sets user's custom property value
- Source:
Example
var CountlyBulk = require("countly-sdk-nodejs").Bulk;
var server = new CountlyBulk({
app_key: "{YOUR-API-KEY}",
url: "https://API_HOST/",
debug: true
});
//adding requests by user
var user = server.addUser({device_id:"my_device_id"});
//set custom key value property
user.custom_set("twitter", "ar2rsawseen");
//create or increase specific number property
user.custom_increment("login_count");
//add new value to array property if it is not already there
user.custom_push_unique("selected_category", "IT");
//send all custom property modified data to server
user.custom_save();
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
string
|
number
|
value to store under provided property |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Sets user's custom property value only if it was not set before
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
string
|
number
|
value to store under provided property |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Unset's/delete's user's custom property
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to delete |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Increment value under the key of this user's custom properties by one
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Increment value under the key of this user's custom properties by provided value
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
number
|
value by which to increment server value |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Multiply value under the key of this user's custom properties by provided value
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
number
|
value by which to multiply server value |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Save maximal value under the key of this user's custom properties
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
number
|
value which to compare to server's value and store maximal value of both provided |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Save minimal value under the key of this user's custom properties
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
number
|
value which to compare to server's value and store minimal value of both provided |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Add value to array under the key of this user's custom properties. If property is not an array, it will be converted to array
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
string
|
number
|
value which to add to array |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Add value to array under the key of this user's custom properties, storing only unique values. If property is not an array, it will be converted to array
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property to attach to user |
value |
string
|
number
|
value which to add to array |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Remove value from array under the key of this user's custom properties
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
name of the property |
value |
string
|
number
|
value which to remove from array |
Returns:
instance
-
Type
-
module:lib/countly-bulk-user
- Description:
- Save changes made to user's custom properties object and send them to server
- Source:
Returns:
instance
-
Type
-
module:lib/countly-bulk-user