Skip to content

mParticle Android

Deeplinking Support

See our Deep Linking Guide for implementation details.

Setting up the Movable-Ink Api Key

Within the application's local.properties, the provided API Key should be specified as follows:

MOVABLE_INK_SDK_API_KEY = "XXX"

Also, in the application manifest file the following meta-data tag should be specified within the application tag:

<meta-data
  android:name="com.movableink.inked.API_KEY"
  android:value="${MOVABLE_INK_SDK_API_KEY}"
/>

Lastly, in the Application level gradle file, under the defaultConfig section:

defaultConfig {
  manifestPlaceholders["MOVABLE_INK_SDK_API_KEY"] = localProperties['MOVABLE_INK_SDK_API_KEY']
}

Configuring The SDK Region:

To ensure compliance with regional requirements, we now require you to specify your region(importantly for EU clients). This is necessary to properly route your data and comply with local regulations.

In your project’s build.gradle (or build.gradle.kts) file, define a gradle property to your project’s defaultConfig block to specify the region:

defaultConfig {
  // Existing configurations...

  // Set your region (default is US, set EU for European clients)
  buildConfigField("String", "MOVABLE_INK_SDK_REGION", "EU")
}

If you don't supply a region, the SDK will default to the US region. If you are unsure which region your company was setup in on the MovableInk Platform, please reach out to your Movable Ink client experience team.

After making changes to the gradle file, perform a gradle sync.

Integrate Kit

Add our Kit to your app module's build.gradle file:

dependencies {
    implementation 'com.movableink.mparticle:{{ current_version }}'
}

In your Application class, initialize mParticle with our Kit's configuration:

       val options: MParticleOptions =
            MParticleOptions
                .builder(this)
                .credentials(
                    "apiKey",
                    "apiSecret",
                ).environment(MParticle.Environment.Development)
                .sideloadedKits(
                    listOf(
                        MovableKit(),
                    ),
                ).logLevel(MParticle.LogLevel.VERBOSE)
                .build()
        MParticle.start(options)

Important

The mParticle API key and secret are obtained from the mParticle dashboard.

Events

Movable Ink supports specific events. If you need to track any custom events, please reach out to your Movable Ink client experience team. They will get you in touch with our Solutions Architecture team, and coordinate with you on the kinds of custom event payload information you want to send to Movable Ink.

Listed below are examples for the out of the box events:

Product Viewed | View Detail
val product = Product
    .Builder("productName", "productSKU", 10.00)
    .quantity(0.0)
    .category("category")
    .build()

MParticle.getInstance()?.logEvent(CommerceEvent
    .Builder(Product.DETAIL, product)
    .currency("USD")
    .build())
Product Added | Add To Cart
val product = Product
    .Builder("productname", "productSKU", 10.00)
    .quantity(0.0)
    .category("category")
    .build()

MParticle.getInstance()?.logEvent(
    CommerceEvent
        .Builder(Product.ADD_TO_CART, product)
        .currency("USD")
        .build(),
)
Category Viewed
val attributes =
    mapOf(
        "id" to "value",
    )

MParticle.getInstance()?.logEvent(
    MPEvent
        .Builder("category_viewed", MParticle.EventType.Other)
        .customAttributes(attributes)
        .build(),
)
Product Searched
val searchAttributes =
    mapOf(
        "query" to "value",
        "url" to "value ",
    )

MParticle.getInstance()?.logEvent(MPEvent
    .Builder("product_searched", MParticle.EventType.Other)
    .customAttributes(searchAttributes)
    .build())
Product Removed | Remove From Cart
val mpProduct =
    Product
        .Builder("productname", "productId", 1.00)
        .quantity(0.0)
        .category("category")
        .build()

MParticle.getInstance()?.logEvent(CommerceEvent
    .Builder(Product.REMOVE_FROM_CART, mpProduct)
    .currency("USD")
    .build())
Order Completed | Purchase
val mpProduct = Product
    .Builder("productName", "productSKU", 10.00)
    .quantity(0.0)
    .category("category")
    .build()

val attributes =
    TransactionAttributes("transaction-id")
        .setRevenue(430.00)

MParticle.getInstance()?.logEvent(CommerceEvent
    .Builder(Product.PURCHASE, mpProduct)
    .transactionAttributes(attributes)
    .currency("USD")
    .build())

Support

If you have questions about setting up the integration, or if you need help troubleshooting a problem, please reach out to your Movable Ink Customer Success Representative. They will put you in contact with our mobile development support team.