Skip to content

Commit

Permalink
Merge pull request #6 from tenjin/release-1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
giraldogdiego authored Jun 20, 2024
2 parents 4add2f8 + 2791a1c commit a9addba
Show file tree
Hide file tree
Showing 51 changed files with 6,809 additions and 41 deletions.
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing

This guide provides instructions for contributing to this Capacitor plugin.

## Developing

### Local Setup

1. Fork and clone the repo.
1. Install the dependencies.

```shell
npm install
```

### Scripts

#### `npm run build`

Build the plugin web assets and generate plugin API documentation using [`@capacitor/docgen`](https://github.com/ionic-team/capacitor-docgen).

It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/esm/`. These files are used in apps with bundlers when your plugin is imported.

Then, Rollup will bundle the code into a single file at `dist/plugin.js`. This file is used in apps without bundlers by including it as a script in `index.html`.

#### `npm run verify`

Build and validate the web and native projects.

This is useful to run in CI to verify that the plugin builds for all platforms.

#### `npm run lint` / `npm run fmt`

Check formatting and code quality, autoformat/autofix if possible.

This template is integrated with ESLint, Prettier, and SwiftLint. Using these tools is completely optional, but the [Capacitor Community](https://github.com/capacitor-community/) strives to have consistent code style and structure for easier cooperation.

## Publishing

There is a `prepublishOnly` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run:

```shell
npm publish
```

> **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.
2 changes: 1 addition & 1 deletion IonicCapacitorTenjin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Pod::Spec.new do |s|
s.static_framework = true
s.ios.deployment_target = '13.0'
s.dependency 'Capacitor'
s.dependency 'TenjinSDK', '1.12.23'
s.dependency 'TenjinSDK', '1.14.3'
s.swift_version = '5.1'
end
101 changes: 79 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Tenjin Ionic Capacitor Plugin
# Ionic Capacitor Tenjin Plugin

# Summary

Expand All @@ -8,15 +8,6 @@ Tenjin's SDK allows users to track events and installs in their iOS apps. To lea

On iOS:
For AppTrackingTransparency, be sure to update your project `.plist` file and add `NSUserTrackingUsageDescription` along with the text message you want to display to users. This library is only available in iOS 14.0+. For further information on this, you can check our [iOS documentation](https://github.com/tenjin/tenjin-ios-sdk#-skadnetwork-and-ios-15-advertiser-postbacks)

On Android:
You will need to add [Google's Install Referrer Library](https://developer.android.com/google/play/installreferrer/library.html) to your gradle dependencies. If you haven’t already installed the [Google Play Services](https://developers.google.com/android/guides/setup) you also need to add it
```gradle
dependencies {
classpath("com.android.installreferrer:installreferrer:1.1.2")
classpath("com.google.android.gms:play-services-analytics:17.0.0")
}
```

# Plugin Integration

Expand Down Expand Up @@ -65,6 +56,21 @@ Tenjin.optIn(params: string[])
Tenjin.optOut(params: string[])
```

### OptIn and OptOut using CMP
```typescript
Tenjin.optInOutUsingCMP()
```

### Opt out of Google DMA parameters
```typescript
Tenjin.optOutGoogleDMA()
```

### Opt in of Google DMA parameters
```typescript
Tenjin.optInGoogleDMA()
```

### Register transaction
```typescript
transaction(productName: string, currencyCode: string, quantity: number, unitPrice: number)
Expand All @@ -80,29 +86,65 @@ Tenjin.eventWithName(name: string)
Tenjin.eventWithNameAndValue(name: string, value: string)
```

### Get attribution info
```typescript
Tenjin.getAttributionInfo()
```
Returns: `JSON`

### Append app subversion
```typescript
Tenjin.appendAppSubversion(subversion: number)
```

### <a id="ilrd"></a>Impression Level Ad Revenue Integration
### Send AdMob impression (ILRD)
```javascript
Tenjin.eventAdImpressionAdMob(json)
```
Parameters:
- `json`: JSON

Tenjin supports the ability to integrate with the Impression Level Ad Revenue (ILRD) feature from,
- AppLovin
- IronSource
- HyperBid
- AdMob
- TopOn
### Send AppLovin impression (ILRD)
```javascript
Tenjin.eventAdImpressionAppLovin(json)
```
Parameters:
- `json`: JSON

This feature allows you to receive events which correspond to your ad revenue that is affected by each advertisement show to a user. To enable this feature, follow the below instructions.
### Send HyperBid impression (ILRD)
```javascript
Tenjin.eventAdImpressionHyperBid(json)
```
Parameters:
- `json`: JSON

:warning: **NOTE: ILRD is a paid feature, so please contact your Tenjin account manager to discuss the price at first before sending ILRD events.**
### Send IronSource impression (ILRD)
```javascript
Tenjin.eventAdImpressionIronSource(json)
```
Parameters:
- `json`: JSON

### <a id="attributionInfo"></a>Attribution Info
### Send TopOn impression (ILRD)
```javascript
Tenjin.eventAdImpressionTopOn(json)
```
Parameters:
- `json`: JSON

Tenjin supports retrieving of attributes, which are required for developers to get analytics installation id (previously known as tenjin reference id). This parameter can be used when there is no advertising id.
### Send TradPlus impression (ILRD)
```javascript
Tenjin.eventAdImpressionTradPlus(json)
```
Parameters:
- `json`: JSON

:warning: **NOTE: Attribution Info is a paid feature, so please contact your Tenjin account manager if you are interested in.**
### Send CAS impression (ILRD)
```javascript
Tenjin.eventAdImpressionCAS(json)
```
Parameters:
- `json`: JSON

### Customer User ID
```javascript
Expand All @@ -116,6 +158,21 @@ Tenjin.getCustomerUserId()
```
Returns: `string`

### Analytics Installation ID

```javascript
Tenjin.getAnalyticsInstallationId()
```
Returns: `string`

### Send Google DMA Parameters
```javascript
Tenjin.setGoogleDMAParametersWithAdPersonalization(adPersonalization, adUserData)
```
Parameters:
- `adPersonalization`: Boolean
- `adUserData`: Boolean

### Update SKAN Postback Conversion Value (iOS only)
```javascript
Tenjin.updatePostbackConversionValue(conversionValue)
Expand Down
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {
apply plugin: 'com.android.library'

android {
namespace "com.tenjin.plugins.capacitor"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
Expand Down Expand Up @@ -51,7 +52,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation 'com.tenjin:android-sdk:1.12.20'
implementation 'com.tenjin:android-sdk:1.16.4'
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tenjin.plugins.capacitor">
>
</manifest>
32 changes: 32 additions & 0 deletions android/src/main/java/com/tenjin/plugins/capacitor/Tenjin.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ public void optOut(String[] params) {
instance.optOutParams(params);
}

public void optInOutUsingCMP() {
instance.optInOutUsingCMP();
}

public void optOutGoogleDMA() {
instance.optOutGoogleDMA();
}

public void optInGoogleDMA() {
instance.optInGoogleDMA();
}

public void transaction(String productName, String currencyCode, Integer quantity, Double unitPrice) {
instance.transaction(productName, currencyCode, quantity, unitPrice);
}
Expand Down Expand Up @@ -76,11 +88,31 @@ public void eventAdImpressionTopOn(JSONObject json) {
instance.eventAdImpressionTopOn(json);
}

public void eventAdImpressionTradPlus(JSONObject json) {
instance.eventAdImpressionTradPlus(json);
}

public void eventAdImpressionCAS(JSONObject json) {
instance.eventAdImpressionCAS(json);
}

public void setCacheEventSetting(Boolean setting) {
instance.setCacheEventSetting(setting);
}

public void setCustomerUserId(String userId) {
instance.setCustomerUserId(userId);
}

public String getCustomerUserId() {
return instance.getCustomerUserId();
}

public String getAnalyticsInstallationId() {
return instance.getAnalyticsInstallationId();
}

public void setGoogleDMAParameters(boolean adPersonalization, boolean adUserData) {
instance.setGoogleDMAParameters(adPersonalization, adUserData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ public void optOutParams(PluginCall call) {
}
}

@PluginMethod
public void optInOutUsingCMP(PluginCall call) {
implementation.optInOutUsingCMP();
call.resolve();
}

@PluginMethod
public void optOutGoogleDMA(PluginCall call) {
implementation.optOutGoogleDMA();
call.resolve();
}

@PluginMethod
public void optInGoogleDMA(PluginCall call) {
implementation.optInGoogleDMA();
call.resolve();
}

@PluginMethod
public void transaction(PluginCall call) {
implementation.transaction(
Expand Down Expand Up @@ -136,6 +154,24 @@ public void eventAdImpressionTopOn(PluginCall call) {
call.resolve();
}

@PluginMethod
public void eventAdImpressionTradPlus(PluginCall call) {
implementation.eventAdImpressionTradPlus(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void eventAdImpressionCAS(PluginCall call) {
implementation.eventAdImpressionCAS(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void setCacheEventSetting(PluginCall call) {
implementation.setCacheEventSetting(call.getBoolean("setting"));
call.resolve();
}

@PluginMethod
public void setCustomerUserId(PluginCall call) {
implementation.setCustomerUserId(call.getString("userId"));
Expand All @@ -149,21 +185,36 @@ public void getCustomerUserId(PluginCall call) {
call.resolve(data);
}

@PluginMethod
public void getAnalyticsInstallationId(PluginCall call) {
JSObject data = new JSObject();
data.put("installationId", implementation.getAnalyticsInstallationId());
call.resolve(data);
}

@PluginMethod
public void setGoogleDMAParameters(PluginCall call) {
boolean adPersonalization = call.getBoolean("adPersonalization", true);
boolean adUserData = call.getBoolean("adUserData", true);
implementation.setGoogleDMAParameters(adPersonalization, adUserData);
call.resolve();
}

@PluginMethod
public void updatePostbackConversionValue(PluginCall call) {
Log.d("TENJIN","Method not available on Android");
Log.d("TENJIN", "Method not available on Android");
call.resolve();
}

@PluginMethod
public void updatePostbackConversionValueCoarseValue(PluginCall call) {
Log.d("TENJIN","Method not available on Android");
Log.d("TENJIN", "Method not available on Android");
call.resolve();
}

@PluginMethod
public void updatePostbackConversionValueCoarseValueLockWindow(PluginCall call) {
Log.d("TENJIN","Method not available on Android");
Log.d("TENJIN", "Method not available on Android");
call.resolve();
}
}
15 changes: 15 additions & 0 deletions ionic-example/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

Chrome >=60
Firefox >=63
Edge >=79
Safari >=13
iOS >=13
16 changes: 16 additions & 0 deletions ionic-example/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
Loading

0 comments on commit a9addba

Please sign in to comment.