Skip to main content

SDK Signing

SDK Signing enhances the security of the Trackier Cordova SDK by authenticating requests sent to the Trackier Mobile Marketing Platform (MMP) using a secret ID and secret key. This ensures data integrity, prevents unauthorized access, and secures communication between your app and Trackier's servers. This section outlines how to configure SDK Signing in your Cordova or Ionic Native application.

Prerequisites

  • Trackier Cordova SDK installed and initialized in your project
  • A Trackier MMP account with access to the Trackier Panel
  • Cordova 9.0 or later
  • For Ionic Native apps:
    • Ionic CLI and Capacitor
    • @awesome-cordova-plugins/core and trackier plugin configured
  • Basic knowledge of JavaScript, TypeScript, Angular (for Ionic Native), and Cordova development

Configure SDK Signing

To enable SDK Signing, retrieve the secret ID and secret key from the Trackier Panel and incorporate them into the SDK configuration during initialization.

Step 1: Retrieve Secret ID and Secret Key

  1. Log in to your Trackier MMP account.
  2. Select your application from the Dashboard.
  3. Navigate to SDK Integration via the left-side navigation menu.
  4. Click on the Advanced tab under SDK Integration.
  5. Copy the Secret ID and Secret Key displayed.

Reference: Screenshot 2022-08-17 at 12:23:01 PM

Step 2: Add Signing to SDK Initialization

Modify your SDK initialization code to include the secret ID and secret key using the setAppSecret method of the TrackierConfig object.

TypeScript Example (Ionic Native)
tab1.page.ts
import { Component } from '@angular/core';
import { TrackierCordovaPlugin, TrackierConfig, TrackierEnvironment } from '@awesome-cordova-plugins/trackier/ngx';

@Component({
selector: 'app-tab1',
templateUrl: 'tab1.page.html',
styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
constructor(private trackierCordovaPlugin: TrackierCordovaPlugin) {}

async ngOnInit() {
// Initialize SDK with Signing
var key = "abcf2270-xxxx-xxxx-a2ae-34903c6e1d53"; // Replace with your SDK key
var trackierConfig = new TrackierConfig(key, TrackierEnvironment.Development);
trackierConfig.setAppSecret("659fb6f1xxxxxxxa29d46c9", "9258fcdb-a7a7-xxxxx-xxxx-65835ed38407"); // Pass secretId and secretKey
this.trackierCordovaPlugin.initializeSDK(trackierConfig);
}
}

JavaScript Example (Pure Cordova)
tab1.page.ts
document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
// Initialize SDK with Signing
var key = "abcf2270-xxxx-xxxx-a2ae-34903c6e1d53"; // Replace with your SDK key
var trackierConfig = new TrackierConfig(key, TrackierEnvironment.Development);
trackierConfig.setAppSecret("659fb6f1xxxxxxxa29d46c9", "9258fcdb-a7a7-xxxxx-xxxx-65835ed38407"); // Pass secretId and secretKey
TrackierCordovaPlugin.initializeSDK(trackierConfig);
}

Parameters

  • Secret ID: The unique identifier for request authentication (e.g., "659fb6f1xxxxxxxa29d46c9").
  • Secret Key: The secure key paired with the secret ID (e.g., "9258fcdb-a7a7-xxxxx-xxxx-65835ed38407").

Expected Outcome

The SDK will sign all requests with the provided secret ID and key, ensuring secure communication with the Trackier MMP. You can verify successful authentication by checking tracking data (e.g., events, user data) in the Trackier Panel without authentication-related errors.

Best Practices

  • Secure Secret Credentials: Store the secret ID and key in environment variables or a secure configuration file, avoiding hardcoding in source code.
  • Validate Credentials: Ensure the secret ID and key are accurately copied from the Trackier Panel to prevent authentication failures.
  • Test in Development Mode: Use TrackierEnvironment.Development to test SDK Signing without affecting production data.
  • Initialize Early: Call setAppSecret during SDK initialization to ensure all subsequent requests are signed.
  • Monitor Authentication: Regularly check the Trackier Panel for authentication-related issues during testing.
  • Comply with Privacy Regulations: Ensure secure handling of tracking data complies with GDPR, CCPA, and other privacy laws.

Troubleshooting

  • Authentication Errors:
    • Verify the secret ID and key match the values in the Trackier Panel's Advanced tab.
    • Ensure setAppSecret is called before initializeSDK.
    • Check console logs for authentication-related errors.
  • Tracking Data Not Appearing:
    • Confirm the SDK is initialized with the correct SDK key and environment.
    • Ensure the secret ID and key are associated with the correct application in the Trackier Panel.
  • Ionic Native Issues:
    • Verify the TrackierCordovaPlugin provider is registered in app.module.ts.
    • Ensure the trackier folder is in node_modules/@awesome-cordova-plugins and ionic cap sync was executed.

For further assistance, refer to the Trackier Documentation Portal or contact Trackier support at support@trackier.com.