This preview of pull request 1639 is meant for internal use only.

Countly Destination

Countly quick info

Countly accepts Track, Page, Identify, Group, and Alias calls. If you reference it in the Integrations object, call it “Countly”.

Countly accepts device-mode data only from a mobile source.

Our Countly destination code is open source on GitHub. Feel free to check it out: iOS, Android.

Getting Started

To get started with Countly and Segment, add our iOS, Android or React Native libraries to your mobile app.

Once the Segment library is integrated with your app, toggle Countly on in your Segment destinations catalog, and add your application’s App Key and Server URL which you can find in your Countly Application Management. If you’re using their cloud hosted solution (not hosting your own Count.ly server), then your Server URL is https://cloud.count.ly.

These new settings will take up to an hour to propagate to all of your existing users. For new users it’ll be instantaneous!

React Native set up

To add the Countly device-mode SDK to a React Native project:

  1. Navigate to the root folder of your project, and run a yarn add countly command to add the destination SDK to your project.
  2. Add an import statement to your project, as in the example below.
    import Countly from '@segment/analytics-react-native-countly'
    
  3. In the same project file, add the destination to the using list in the await command.
    await analytics.setup('YOUR_WRITE_KEY', {
      // Add any of your Device-mode destinations. This ensures they load before continuing.
      using: Countly
      // ...
    })
    
  4. Finally, change to your iOS development folder ( cd ios ) and run pod install.

Track

Countly is built to help you better understand your user’s behavior. To accomplish that, you’ll want to track your user’s actions in detail.

Whenever you call track from our iOS or Android library, we’ll record an event with Countly. track takes the name of the event and any optional properties you want to associate with the event.

Custom Events

All you have to do is make a track call to send a custom event to Countly. The event name will map to the countly “key” and we automatically set “count” to 1. If you add properties to the event those will be passed to Countly as well.

Revenue

It’s easy to track revenue in Countly through Segment. All you have to do is use our track method with a property labeled revenue. The value must be a number.

Supported Sources and Connection Modes

Before you start, make sure Countly supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️
☁️ Cloud-mode ⬜️ ⬜️ ⬜️

This destination requires that you use a Device-based Connection Mode for Mobile data. Make sure you package the Countly mobile SDK with the Segment mobile library.

Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

App Key

You can find your App Key on your Countly server. It should be 40 characters long, and look something like this: c801156663bfcc4694aafc0dd26023a6d9b9544a.

Server URL

You’ll need to add your own Countly Server URL here.

This page was last modified: 23 Mar 2021



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account