Skip to content

Commit

Permalink
Merge pull request #500 from Countly/countly-types
Browse files Browse the repository at this point in the history
Countly types
  • Loading branch information
turtledreams committed Jun 10, 2024
2 parents d428110 + bbe8070 commit a6af6d8
Show file tree
Hide file tree
Showing 6 changed files with 586 additions and 40 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 24.4.1
- Added types for the SDK

## 24.4.0
! Minor breaking change ! For implementations using `salt` the browser compatability is tied to SubtleCrypto's `digest` method support

Expand Down
25 changes: 0 additions & 25 deletions examples/Angular/countly.d.ts

This file was deleted.

69 changes: 58 additions & 11 deletions examples/Angular/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';

import Countly from 'countly-sdk-web';

Expand All @@ -17,15 +15,64 @@ if (COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.s
// initializing countly with params
Countly.init({
app_key: COUNTLY_APP_KEY,
url: COUNTLY_SERVER_KEY, //your server goes here
url: COUNTLY_SERVER_KEY,
debug: true
});

// Automatic tracking
Countly.track_sessions();
Countly.track_clicks();
Countly.track_links();
Countly.track_forms();
Countly.track_errors();
Countly.track_scrolls();
Countly.track_pageview();

if (environment.production) {
enableProdMode();
// Showing a feedback widget
Countly.get_available_feedback_widgets(function (widgets, err) {
console.log('Available feedback widgets:', widgets);
if (widgets && widgets.length) {
console.log('Presenting feedback widget:', widgets[0]);
Countly.present_feedback_widget(widgets[0]); // Show the first widget
}
});

}
// Reporting a feedback widget's result manually
Countly.get_available_feedback_widgets(function (widgets, err) {
console.log('Available feedback widgets:', widgets);
if (widgets && widgets.length) {
console.log('Reporting feedback widget:', widgets[0]);
Countly.getFeedbackWidgetData(widgets[0], function (data, err) {
console.log('Feedback widget data:', data);
Countly.reportFeedbackWidgetManually(widgets[0], data, null); // Report the first widget's data as null
});
}
});

// add a custom event
Countly.add_event({
key: "test",
count: 1,
dur: 50,
sum: 0.99,
segmentation: {
"Country": "Germany",
"Age": "28"
}
});

// send some user properties
Countly.user_details({
name: "John Doe",
username: "johndoe",
organization: "Countly",
phone: "1234567890",
picture: "https://path.to/picture",
});

// set custom user property
Countly.userData.set("key", "value");
Countly.userData.save();

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));
Loading

0 comments on commit a6af6d8

Please sign in to comment.