Skip to content

Commit

Permalink
feat(tealium): add tealium ionic wrappers (#2414)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigrouse authored and danielsogl committed May 3, 2018
1 parent cea1dc1 commit 5f41ef1
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 23 deletions.
6 changes: 3 additions & 3 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ You need to run `npm run build` in the `ionic-native` project, this will create

### Cleaning the code

You need to run `npm run lint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
You need to run `npm run lint` to analyze the code and ensure its consistency with the repository style. Fix any errors before submitting a PR.

### 'Wrapping' Up

That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.
That's it! The only thing left to do is rigorously document the plugin and its usage. Take a look at some of the other plugins for good documentation styles.

## Commit Message Format

Expand Down Expand Up @@ -218,4 +218,4 @@ Example:
```ts
@CordovaFunctionOverride()
someMethod(): Observable<any> { return; }
```
```
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions src/@ionic-native/plugins/tealium-adidentifier/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';

/**
* @paid
* @name TealiumAdIdentifier
* @description
* This module depends on the [Tealium Cordova Plugin](https://github.com/tealium/cordova-plugin). Without it, this module will not do anything.
* Makes the IDFA and Google Ad Identifier available in the Tealium data layer.
*
* @usage
* ```
* import { TealiumAdIdentifier } from '@ionic-native/tealium-adidentifier';
*
*
* constructor(private adIdentifier: TealiumAdIdentifier) { }
*
* ...
*
*
* this.adIdentifier.setPersistent("main");
* this.adIdentifier.setVolatile("main");
*
* ```
*/

@Plugin({
pluginName: 'TealiumAdIdentifier',
plugin: 'tealium-cordova-adidentifier', // npm package name, example: cordova-plugin-camera
pluginRef: 'window.tealiumAdIdentifier', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin
platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS']
install: '', // OPTIONAL install command, in case the plugin requires variables
})

@Injectable()
export class TealiumAdIdentifier extends IonicNativePlugin {

/**
* This function stores the ad identifier information as persistent data
* @param instanceName {string} Your arbitrary Tealium instance name provided at init time
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
setPersistent(instanceName: string): Promise<any> {
return;
}

/**
* This function stores the ad identifier information as volatile data
* @param instanceName {string} Your arbitrary Tealium instance name provided at init time
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
setVolatile(instanceName: string): Promise<any> {
return;
}

}
59 changes: 59 additions & 0 deletions src/@ionic-native/plugins/tealium-installreferrer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';

/**
* @paid
* @name TealiumInstallReferrer
* @description
* This module depends on the [Tealium Cordova Plugin](https://github.com/tealium/cordova-plugin). Without it, this module will not do anything.
* Implements a Broadcast Receiver for the INSTALL_REFERRER intent.
*
* @usage
* ```
* import { TealiumInstallReferrer } from '@ionic-native/tealium-installreferrer';
*
*
* constructor(private installReferrer: TealiumInstallReferrer) { }
*
*
* this.installReferrer.setPersistent("main");
* this.installReferrer.setVolatile("main");
*
*
*
* ```
*/

@Plugin({
pluginName: 'TealiumInstallReferrer',
plugin: 'tealium-cordova-installreferrer', // npm package name, example: cordova-plugin-camera
pluginRef: 'window.tealiumInstallReferrer', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin
platforms: ['Android'], // Array of platforms supported, example: ['Android', 'iOS']
install: '', // OPTIONAL install command, in case the plugin requires variables
})

@Injectable()
export class TealiumInstallReferrer extends IonicNativePlugin {

/**
* This function stores the install referrer information as persistent data
* @param instanceName {string} Your arbitrary Tealium instance name provided at init time
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
setPersistent(instanceName: string): Promise<any> {
return;
}

/**
* This function stores the install referrer information as volatile data
* @param instanceName {string} Your arbitrary Tealium instance name provided at init time
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
setVolatile(instanceName: string): Promise<any> {
return;
}

}
Loading

0 comments on commit 5f41ef1

Please sign in to comment.