# cordova-plugin-google-ump

> ionic wrapper for google ump sdk

Latest version **1.0.0** (published 2020-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-google-ump
pnpm add cordova-plugin-google-ump
yarn add cordova-plugin-google-ump
bun add cordova-plugin-google-ump
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-09-11 |
| First published | 2020-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | jellomaster |
| Maintainers | jellomaster2 |
| Keywords | google, consent, sdk, admob, ads, funding choices, idfa, ecosystem:cordova, cordova-android, cordova-ios |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-google-ump
- Repository: https://github.com/jellomaster/cordova-plugin-google-ump
- Homepage: https://github.com/jellomaster/cordova-plugin-google-ump#readme
- Issues: https://github.com/jellomaster/cordova-plugin-google-ump/issues
- npm.io page: https://npm.io/package/cordova-plugin-google-ump

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-09-11

## README

# cordova-plugin-google-ump

This plugin is an Ionic Cordova wrapper for the Google UMP SDK.
Google UMP (User Messaging Platform) SDK is used for asking users in the European Economic Area (EEA) for permission to display personalized ads or 

## News

**Version 1.0.0 / 2020-09-11:**
Initial plugin release.

## Installation

```cmd
ionic cordova plugin add cordova-plugin-google-ump
```

## Ionic Include
Include the plugin in your app.module.ts

```typescript
...

import {Consent} from '../../plugins/cordova-plugin-google-ump/www/consent-typescript-wrapper';

...

@NgModule({
  ...

  providers: [
    ...
    Ump
    ...
  ]
  ...
})
export class AppModule { }
})

```

## Funding Choices Settings
In order to use Google UMP SDK, you need to link your Admob account to Funding Choices (https://fundingchoices.google.com) and create EU Consent & IDFA messages for your app

## Supported Platforms

- Android (Coming soon)
- iOS

## Methods

- ump.verifyConsent
- ump.forceForm

## consent.verifyConsent

Should be called on every app start. Checks and returns a consent status. If the user has not made any consent decision yet, it will display the appropriate consent form for EEA users.  For IOS 14+ users will be asked for the AppTrackingTransparency permission after.

### Params
```typescript
verifyConsent(isAgeConsent :boolean, isDebug :boolean) :Promise<ConsentResult>
```

- isAgeConsent: If set to true, on the dialog is shown an option to the user, where he can choose to buy an ad-free pro version.
- isDebug: If set to true, the device acts like it is in the EEA, even if it is not.


### Result
```typescript
interface ConsentResult {
	consent: boolean; // true if given consent / false other
 dialog
	hasShownDialog: boolean; // if false, user already made a decision earlier and there was no need to show the dialog
}
```


### Example (Ionic)
```typescript
this.ump.verifyConsent(true, false)
			.then((result) => {
				console.log(result);
			})
			.catch((error) => {
				console.log(error);
			});
```

### Example (Cordova)
```javascript
window['Ump'].verifyConsent(isAgeConsent, isDebug,
				function(result) {/* do something with the result */},
				function(error) {/* handle the error case */}
			);
```

## consent.forceForm

Method to change the made decision later. This option should be offered to the user in the settings, that he can change his decision at any time.
This method has no check if a user is really in the EEA or not, the dialog is shown to every user. Use method verifyConsent on load to see if the user needs to see a form or not

### Params
```typescript
forceForm() :Promise<ConsentResult>
```

### Result
```typescript
interface ConsentResult {
    consent: boolean; // true if given consent / false other
 dialog
    hasShownDialog: boolean; // in this case always true
}

```


### Example (Ionic)
```typescript
this.ump.forceForm()
			.then((result) => {
				console.log(result);
			})
			.catch((error) => {
				console.log(error);
			});
```

### Example (Cordova)
```javascript
window['Ump'].then(
				function(result) {/* do something with the result */},
				function(error) {/* handle the error case */}
			);
```

## iOS specific issues

When installing the plugin on iOS it will download the Google UMP SDK and install it as a CocoaPod. It will also create a yourprojectname.xcworkspace file. To build 
your project for iOS you will need to open the .xcworkspace file in XCode and build it there, the command line build does not work correctly with workspaces instead of
projects.

---
_Source: https://npm.io/package/cordova-plugin-google-ump · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
