We are moving to Discord!

Join us on the Countly Community Discord Server! Engage in discussions, share your feature ideas, and learn from fellow Countly users to build exceptional apps and experiences.

Trying to create a new custom event

I am using Vue with countly web sdk version 2 and trying to create a new custom event but not succeeded. Can anyone help me with that?

also tried with node js sdk it is the same.

QUERY

PAYLOAD

 

RESPONSE

COUNTLY SETTINGS PAGE

COUNTLY UI

Database Collections

0

Comments

14 comments
  • Official comment

    Hello,
    Is it possible for you to share your Countly initialization code and the snippet where you submit and create the event? 

    Comment actions Permalink
  • NODEJS

    const countlyConfig = {
        app_key: config.get('log:countly:appKey'),
        url: config.get('log:countly:url'),
        debug: config.get('log:countly:debug')
    }
    Countly.init(countlyConfig);
    Countly.setLoggingEnabled(true);
    Countly.group_features({all:["sessions","events","views","crashes","attribution","users","location"]});
    Countly.add_consent("all");
    Countly.track_errors();
    Countly.begin_session();

    Countly.add_event({
    key:'custom',
      count: 1,
      segmentation: {test: 1, test2: 2}
    });
    0
    Comment actions Permalink
  • I can see the request data in the Countly -> Request Logs

     

    0
    Comment actions Permalink
  • For Vue, I tried to do it myself but did not work then decided to use the plugin vue-countly

    with that vue-countly plugin Initialize:

    import Countly from 'countly-sdk-web'; // Version 2
    import VueCountly from 'vue-countly'; // Version 1 for Vue v2

    Vue.use(VueCountly, Countly, {
        app_key: mixins.methods.xploreConfig('log.countly.appKey'),
        url: mixins.methods.xploreConfig('log.countly.url'),
        debug: mixins.methods.xploreConfig('log.countly.debug'),
        app_version: mixins.methods.package('version')
        //force_post: true
      });

    // In Main App:
    mounted() {
    this.$Countly.q.push(['track_sessions']);
        this.$Countly.q.push(['track_pageview']);
        this.$Countly.q.push(['track_clicks']);
        this.$Countly.q.push(['track_scrolls']);
        this.$Countly.q.push(['track_errors']);
        this.$Countly.q.push(['track_links']);
        this.$Countly.q.push(['track_forms']);
        this.$Countly.q.push(['collect_from_forms']);
    }


    // in the component:
    const countlyData = {
      "key": logData.event,
      "count": 1,
    "segmentation": _.omit(logData, ['event'])
    };
    console.warn({countlyData});
    /*
    countlyData: {
    count: 1
    key: "profileClick"
    segmentation: {
      groupName: "navbar"
      message: "User Clicks Open User Dropdown"
      type: "info"
      user: "61cce513ff6d325274cc84c5"
    }
    }
    */
    Vue.Countly.add_event(countlyData)
    0
    Comment actions Permalink
  • Debug Logs:

    [INFO] check_consent, require_consent is off, no consent is necessary countly.js:3210
    [INFO] Successfully adding event: {"key":"profileClick","count":1,"segmentation":{"type":"info","groupName":"navbar","message":"User Clicks Open User Dropdown","user":"61cce513ff6d325274cc84c5"}} countly.js:3210
    [INFO] check_consent, Checking if consent is given for specific feature countly.js:3210
    [INFO] check_consent, require_consent is off, no consent is necessary countly.js:3278
    XHR finished loading: GET "https://countly.xplorelabs.com/i?events=%5B%7B%22key%22%3A%22%5BCLY%5D_action%22%2C%22count%22%3A1%2C%22segmentation%22%3A%7B%22type%22%3A%22click%22%2C%22x%22%3A1491%2C%22y%22%3A33%2C%22width%22%3A1794%2C%22height%22%3A1699%2C%22view%22%3A%22%2F%22%2C%22domain%22%3A%22localhost%22%7D%2C%22timestamp%22%3A1649138779119%2C%22hour%22%3A9%2C%22dow%22%3A2%7D%2C%7B%22key%22%3A%22profileClick%22%2C%22count%22%3A1%2C%22segmentation%22%3A%7B%22type%22%3A%22info%22%2C%22groupName%22%3A%22navbar%22%2C%22message%22%3A%22User%20Clicks%20Open%20User%20Dropdown%22%2C%22user%22%3A%2261cce513ff6d325274cc84c5%22%7D%2C%22timestamp%22%3A1649138779192%2C%22hour%22%3A9%2C%22dow%22%3A2%7D%5D&app_key=79d303e7f170bb89ec17b6808469626267c27dff&device_id=f42cd769-6180-492b-8057-a024deb9d716&sdk_name=javascript_native_web&sdk_version=21.11.3&timestamp=1649138779332&hour=9&dow=2".
    0
    Comment actions Permalink
  • Thank you for your detailed clarification. As you are seeing your event at request logs I am more curious about your server version. Can you please let me know your server version and also if possible can you please check if there are any active filtering rules under the utilities section?

    0
    Comment actions Permalink
  • Countly Running in docker
    `Countly Community Edition v20.11.2`

    Distributor ID: Debian

    Description: Debian GNU/Linux 10 (buster)

    Release: 10

    Codename: buster

    4.15.0-166-generic

    I did not find anything related to filtering under utilities section

    0
    Comment actions Permalink
  • Once more thank you clarifying it further. It looks like your server version is not up to date. This can cause some issues with displaying your events. To prevent these issues and to give you the necessary support please upgrade your server following the instructions here: https://support.count.ly/hc/en-us/articles/4416839480601-Docker-and-Kubernetes-Upgrading-the-Countly-Application-on-the-Kubernetes-Platform-

    Please let me know if this fixes your problem, and if you have any other questions please do not hesitate to contact us again. 

    0
    Comment actions Permalink
  • I did upgrade

    and now version is: Countly Community Edition v21.11.0

    but nothing changed 

    LATEST REQUEST LOG:

    REQUEST:

    events=%5B%7B%22key%22%3A%22%5BCLY%5D_action%22%2C%22count%22%3A1%2C%22segmentation%22%3A%7B%22type%22%3A%22click%22%2C%22x%22%3A725%2C%22y%22%3A390%2C%22width%22%3A1794%2C%22height%22%3A1699%2C%22view%22%3A%22%2F%22%2C%22domain%22%3A%22localhost%22%7D%2C%22timestamp%22%3A1649149889765%2C%22hour%22%3A12%2C%22dow%22%3A2%7D%2C%7B%22key%22%3A%22linkClick%22%2C%22count%22%3A1%2C%22segmentation%22%3A%7B%22href%22%3A%22%22%2C%22text%22%3A%22test%201%22%2C%22id%22%3A%22%22%2C%22view%22%3A%22%2F%22%7D%2C%22timestamp%22%3A1649149889766%2C%22hour%22%3A12%2C%22dow%22%3A2%7D%2C%7B%22key%22%3A%22changeInstance%22%2C%22count%22%3A1%2C%22segmentation%22%3A%7B%22type%22%3A%22info%22%2C%22groupName%22%3A%22user%22%2C%22message%22%3A%22User%20Clicks%20Change%20Instance%22%2C%22newInstance%22%3A%22test%22%2C%22user%22%3A%2261cce513ff6d325274cc84c5%22%7D%2C%22timestamp%22%3A1649149890075%2C%22hour%22%3A12%2C%22dow%22%3A2%7D%5D&app_key=79d303e7f170bb89ec17b6808469626267c27dff&device_id=f42cd769-6180-492b-8057-a024deb9d716&sdk_name=javascript_native_web&sdk_version=21.11.3&timestamp=1649149890240&hour=12&dow=2

    EVENTS:

     

    0
    Comment actions Permalink
  • is there anything that I should do to have events?

    0
    Comment actions Permalink
  • Lets first eliminate other possibilities before moving onto a different method. If possible can you please check your visitor profiles and click on the user that you have sent the event from. Can you see any events when you select the time frame as today? Any non custom events visible etc?

    0
    Comment actions Permalink
  • Nope, I could not see or maybe I did not understand correctly which page I should check events for the user?

     

    0
    Comment actions Permalink
  • I think you are using the old UI so it must be under visitors -> visitors profile. If you click one of the users there, it must open a page where you can see session info and event timeline as well as information about the user. Let's check if we can see any event there.

    0
    Comment actions Permalink
  • Fixed when I update to the v22.0.3 thanks for your help Deniz

    0
    Comment actions Permalink

Please sign in to leave a comment.