Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK-4592] [BD-2646] Cordova - Add a comprehensive list of configurations for Android and iOS #6939

Merged
merged 10 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
nav_title: Analytics
article_title: Analytics integration
page_order: 3
---

# Analytics integration

> Learn how to integrate analytics for the Cordova Braze SDK.

{% multi_lang_include cordova/prerequisites.md %}

## Logging custom events

To log custom events, use the `logCustomEvent()` method. For more in-depth instructions, see the [Android]({{site.baseurl}}/developer_guide/platform_integration_guides/android/analytics/tracking_custom_events/#tracking-custom-events) and [iOS]({{site.baseurl}}/developer_guide/platform_integration_guides/swift/analytics/tracking_custom_events/) guides for logging custom events.

```javascript
var properties = {};
properties["KEY"] = "VALUE";
BrazePlugin.logCustomEvent("CUSTOM_EVENT_WITH_PROPERTIES", properties);
```

## Logging purchases

To log purchases, use the `logPurchase()` method. For more in-depth instructions, see the [Android]({{site.baseurl}}/developer_guide/platform_integration_guides/android/analytics/logging_purchases/#logging-purchases) and [iOS]({{site.baseurl}}/developer_guide/platform_integration_guides/swift/analytics/logging_purchases/) guides for logging purchases.

```javascript
var properties = {};
properties["KEY"] = "VALUE";
BrazePlugin.logPurchase("PRODUCT_ID", 10, "USD", 5, properties);
```

{% alert tip %}
If you want to log purchases at the order level instead of the product level, you can use order name or order category as the `product_id`. Refer to our [purchase object specification]({{site.baseurl}}/api/objects_filters/purchase_object/#product-id-naming-conventions) to learn more.
{% endalert %}

## Setting custom attributes

To set custom attributes, use the `setCustomUserAttribute()` method. For more in-depth instructions, see the [Android]({{site.baseurl}}/developer_guide/platform_integration_guides/android/analytics/setting_custom_attributes/) and [iOS]({{site.baseurl}}/developer_guide/platform_integration_guides/swift/analytics/setting_custom_attributes/) guides setting custom attributes.

```javascript
BrazePlugin.setCustomUserAttribute("KEY", "VALUE");
```

## Setting user IDs

To set user IDs, use the `changeUser()` method. For more in-depth instructions, see the [Android]({{site.baseurl}}/developer_guide/platform_integration_guides/android/analytics/setting_user_ids/) and [iOS]({{site.baseurl}}/developer_guide/platform_integration_guides/swift/analytics/setting_user_ids/) guides for setting user IDs.

```javascript
BrazePlugin.changeUser("USER_ID");
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
nav_title: Changelog
article_title: Changelog for Cordova SDK
page_order: 30
page_order: 10
page_type: update
platform:
- Cordova
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
---
nav_title: Content Cards
article_title: Content Cards Integration for Cordova
platform:
- Cordova
- iOS
- Android
page_order: 3
channel: content cards
page_type: reference
description: "This article covers integrate and customize Content Cards for Cordova."

article_title: Content Cards integration
page_order: 2
---

# Content Card integration
# Content Cards integration

> Learn how to integrate Content Cards for the Cordova Braze SDK.

> This article covers how to set up Content Cards for Cordova.
{% multi_lang_include cordova/prerequisites.md %}

To get started, the Braze SDKs include a default card feed. To show the card feed you can use the `BrazePlugin.launchContentCards()` method.
## Card Feeds

The default card feed included with the Braze SDK will handle all analytics tracking, dismissals, and rendering for a user's Content Cards.
The Braze SDK includes a default card feed. To show the default card feed, you can use the `launchContentCards()` method. This method handles all analytics tracking, dismissals, and rendering for a user's Content Cards.

## Customization
## Content Cards

You can use these additional methods to build a custom Content Cards Feed within your app:

|Method | Description |
|---|---|
|`BrazePlugin.requestContentCardsRefresh()`|Sends a background request to request the latest Content Cards from the Braze SDK server.|
|`BrazePlugin.getContentCardsFromServer(successCallback, errorCallback)`|Retrieves Content Cards from the Braze SDK. This will request the latest Content Cards from the server and return the list of cards upon completion.|
|`BrazePlugin.getContentCardsFromCache(successCallback, errorCallback)`|Retrieves Content Cards from the Braze SDK. This will return the latest list of cards from the local cache, which was updated at the last refresh.|
|`BrazePlugin.logContentCardClicked(cardId)`|Logs a click for the given Content Card ID.|
|`BrazePlugin.logContentCardImpression(cardId)`|Logs an impression for the given Content Card ID.|
|`BrazePlugin.logContentCardDismissed(cardId)`|Logs a dismissal for the given Content Card ID.|
|`requestContentCardsRefresh()`|Sends a background request to request the latest Content Cards from the Braze SDK server.|
|`getContentCardsFromServer(successCallback, errorCallback)`|Retrieves Content Cards from the Braze SDK. This will request the latest Content Cards from the server and return the list of cards upon completion.|
|`getContentCardsFromCache(successCallback, errorCallback)`|Retrieves Content Cards from the Braze SDK. This will return the latest list of cards from the local cache, which was updated at the last refresh.|
|`logContentCardClicked(cardId)`|Logs a click for the given Content Card ID.|
|`logContentCardImpression(cardId)`|Logs an impression for the given Content Card ID.|
|`logContentCardDismissed(cardId)`|Logs a dismissal for the given Content Card ID.|
{: .reset-td-br-1 .reset-td-br-2}

This file was deleted.

This file was deleted.

Loading