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

feat: clevertap integration #196

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions packages/example/lib/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:rudder_integration_clevertap_flutter/rudder_integration_clevertap_flutter.dart';
import 'package:rudder_plugin_db_encryption/rudder_plugin_db_encryption.dart';
import 'package:rudder_sdk_flutter/RudderController.dart';
import 'package:rudder_integration_appcenter_flutter/rudder_integration_appcenter_flutter.dart';
Expand Down Expand Up @@ -62,6 +63,7 @@ class HomeScreenState extends State<HomeScreen> {
..withFactory(RudderIntegrationFirebaseFlutter())
..withFactory(RudderIntegrationBrazeFlutter())
..withFactory(RudderIntegrationAmplitudeFlutter())
..withFactory(RudderIntegrationClevertapFlutter())
..withDataPlaneUrl(
dotenv.env['DATA_PLANE_URL'] ?? "https://hosted.rudderlabs.com")
..withMobileConfig(mc)
Expand Down
9 changes: 6 additions & 3 deletions packages/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
rudder_sdk_flutter:
path: "../plugins/rudder_plugin"
rudder_plugin_db_encryption:
path: "../integrations/rudder_plugin_db_encryption"
path: "../plugins/rudder_plugin_db_encryption"
rudder_integration_amplitude_flutter:
path: "../integrations/rudder_integration_amplitude_flutter"
rudder_integration_adjust_flutter:
Expand All @@ -29,6 +29,9 @@ dependencies:
path: "../integrations/rudder_integration_leanplum_flutter"
rudder_integration_appsflyer_flutter:
path: "../integrations/rudder_integration_appsflyer_flutter"
rudder_integration_clevertap_flutter:
path: "../integrations/rudder_integration_clevertap_flutter"

# rudder_integration_kochava_flutter:
# path: "../integrations/rudder_integration_kochava_flutter"
# When depending on this package from a real application you should use:
Expand All @@ -47,8 +50,8 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
flutter_dotenv: ^5.0.2
cupertino_icons: ^1.0.8
flutter_dotenv: ^5.2.1

dev_dependencies:
flutter_lints: ^2.0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
**/doc/api/
.dart_tool/
.packages
build/
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: android
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: ios
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 1.0.0

- Stable release of Rudderstack Clevertap Integration on Flutter
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 RudderStack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# What is RudderStack?

[RudderStack](https://rudderstack.com/) is a **customer data pipeline tool** for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.

With RudderStack, you can build customer data pipelines that connect your whole customer data stack and then make them smarter by triggering enrichment and activation in customer tools based on analysis in your data warehouse. Its easy-to-use SDKs and event source integrations, Cloud Extract integrations, transformations, and expansive library of destination and warehouse integrations makes building customer data pipelines for both event streaming and cloud-to-warehouse ELT simple.

Questions? Please join our [Slack channel](https://www.rudderstack.com/join-rudderstack-slack-community/) or read about us on [Product Hunt](https://www.producthunt.com/posts/rudderstack).

## Integrating Clevertap with the RudderStack Flutter SDK

1. Add [Clevertap](https://clevertap.com/) as a destination in the [RudderStack dashboard](https://app.rudderstack.com/).

2. Open `pubspec.yaml` and add `rudder_integration_clevertap_flutter` under `dependencies` section:

```groovy
dependencies:
rudder_integration_clevertap_flutter: ^1.0.0
```

3. Navigate to your Application's root folder and install all the required dependencies with:

```bash
flutter pub get
```

4. Import the module you added above and add it to your SDK initialization code as shown below:

```typescript
import 'package:rudder_sdk_flutter/RudderController.dart';
import 'package:rudder_sdk_flutter_platform_interface/platform.dart';
import 'package:rudder_integration_clevertap_flutter/rudder_integration_clevertap_flutter.dart';

RudderConfigBuilder builder = RudderConfigBuilder();
builder.withDataPlaneUrl(DATA_PLANE_URL);
builder.withFactory(RudderIntegrationClevertapFlutter());
final RudderController rudderClient = RudderController.instance;
rudderClient.initialize(WRITE_KEY,
config: builder.build(), options:null);
```

## Sending Events

Follow the steps from our [RudderStack Flutter SDK](https://github.com/rudderlabs/rudder-sdk-flutter#send-events) repo.

## Contact Us

If you come across any issues while configuring or using this integration, please feel free to start a conversation on our [Slack](https://www.rudderstack.com/join-rudderstack-slack-community/) channel. We will be happy to help you.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
group 'com.rudderstack.sdk.flutter.integrations.rudder_integration_clevertap_flutter'
version '1.0'

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
}
}

rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 16
}
}

dependencies {
// Rudder Android Core SDK Dependencies
implementation 'com.rudderstack.android.sdk:core:[1.7.0, 2.0.0)'
implementation project(path: ':rudder_plugin_android')
// Rudder-Clevertap Android Device Mode
implementation 'com.rudderstack.android.integration:clevertap:1.0.1'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rudder_integration_clevertap_flutter'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rudderstack.sdk.flutter.integrations.rudder_integration_clevertap_flutter">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.rudderstack.sdk.flutter.integrations.rudder_integration_clevertap_flutter;

import static com.rudderstack.sdk.flutter.RudderSdkFlutterPlugin.addIntegration;

import androidx.annotation.NonNull;
import com.rudderstack.android.integrations.clevertap.CleverTapIntegrationFactory;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;

/** RudderIntegrationClevertapFlutterPlugin */
public class RudderIntegrationClevertapFlutterPlugin implements FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private MethodChannel channel;

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel =
new MethodChannel(
flutterPluginBinding.getBinaryMessenger(), "rudder_integration_clevertap_flutter");
channel.setMethodCallHandler(this);
}

@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("addFactory")) {
addIntegration(CleverTapIntegrationFactory.FACTORY);
// To do with result
} else {
result.notImplemented();
}
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/

.DS_Store
*.swp
profile

DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m

.generated/

*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3

!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3

xcuserdata

*.moved-aside

*.pyc
*sync/
Icon?
.tags*

/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface RudderIntegrationClevertapFlutterPlugin : NSObject <FlutterPlugin>
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#import <rudder_plugin_ios/RudderSdkFlutterPlugin.h>

#import "RudderCleverTapFactory.h"
#import "RudderIntegrationClevertapFlutterPlugin.h"

@implementation RudderIntegrationClevertapFlutterPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel =
[FlutterMethodChannel methodChannelWithName:@"rudder_integration_clevertap_flutter"
binaryMessenger:[registrar messenger]];
RudderIntegrationClevertapFlutterPlugin* instance =
[[RudderIntegrationClevertapFlutterPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([call.method isEqualToString:@"addFactory"]) {
[RudderSdkFlutterPlugin addIntegration:[RudderCleverTapFactory instance]];
// To do with result
} else {
result(FlutterMethodNotImplemented);
}
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint rudder_integration_clevertap_flutter.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'rudder_integration_clevertap_flutter'
s.version = '1.0.1'
s.summary = "RudderStack's Flutter Device Mode for the Clevertap Destination"
s.description = <<-DESC
Rudder is a platform for collecting, storing and routing customer event data to dozens of tools. Rudder is open-source, can run in your cloud environment (AWS, GCP, Azure or even your data-centre) and provides a powerful transformation framework to process your event data on the fly.
DESC
s.homepage = 'https://github.com/rudderlabs/rudder-sdk-flutter/tree/main/packages/integrations'
s.license = { :file => '../LICENSE' }
s.author = { 'RudderStack' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.static_framework = true
s.dependency 'Flutter'
s.dependency 'rudder_plugin_ios'
s.dependency 'Rudder-CleverTap', '1.1.2'
s.platform = :ios, '12.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
end
Loading