Skip to content

Commit

Permalink
Update to Kotlin 1.0.0. + Json Remote Command (#5) (#9)
Browse files Browse the repository at this point in the history
* Update to Kotlin 1.0.0. + Json Remote Command

* Correct import for constants

* Fixes per PR feedback (#6)

* Fixes per PR feedback

* Readme copyright date update

* remove import

Co-authored-by: jameskeith <james.keith@tealium.com>

* Formatting items param for FB (#8)

* Update to handle items param + format correctly for firebase

* Cleanup imports

* Refactor for single product item

* Add switch default log stmt

* Rename items format methods

* Remove deprecated FB event/param constants per review feedback

* Code review updates

Co-authored-by: jameskeith <james.keith@tealium.com>

Co-authored-by: jameskeith <james.keith@tealium.com>
  • Loading branch information
tamayok and jameskeith authored Nov 10, 2020
1 parent dfc9712 commit 6078722
Show file tree
Hide file tree
Showing 19 changed files with 559 additions and 430 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Use of this software is subject to the terms and conditions of the license agree


---
Copyright (C) 2012-2019, Tealium Inc.
Copyright (C) 2012-2020, Tealium Inc.
11 changes: 8 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 29
defaultConfig {
applicationId "com.tealium.example"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
Expand All @@ -21,9 +22,11 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.tealium:library:5.7.1'
implementation "com.tealium:kotlin-remotecommand-dispatcher:1.0.0"
implementation "com.tealium:kotlin-tagmanagement-dispatcher:1.0.0"
implementation "com.tealium:kotlin-lifecycle:1.0.0"
releaseImplementation "com.tealium.remotecommands:firebase:$tealium_firebase_version"
debugImplementation project(path:':firebase')
releaseImplementation 'com.tealium.remotecommands:firebase:1.0.1'

implementation 'com.google.firebase:firebase-analytics:17.4.0'
implementation 'com.google.firebase:firebase-iid:20.1.6'
Expand All @@ -32,6 +35,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

apply plugin: 'com.google.gms.google-services'
89 changes: 89 additions & 0 deletions app/src/main/assets/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"config": {
"firebase_analytics_enabled": "true",
"firebase_session_timeout_seconds": "30",
"firebase_log_level": "max",
"firebase_session_minimum_seconds": "100"
},
"mappings": {
"achievement_id": "event.param_achievement_id",
"ad_network_click_id": "event.param_ad_network_click_id",
"affiliation": "event.param_affiliation",
"campaign_keywords": "event.param_cp1",
"campaign": "event.param_campaign",
"game_character": "event.param_character",
"checkout_option": "event.param_checkout_option",
"checkout_step": "event.param_checkout_step",
"content": "event.param_content",
"content_type": "event.param_content_type",
"coupon": "event.param_coupon",
"creative_name": "event.param_creative_name",
"creative_slot": "event.param_creative_slot",
"currency_code": "event.param_currency",
"travel_destination": "event.param_destination",
"end_date": "event.param_end_date",
"flight_number": "pevent.param_flight_number",
"group_id": "event.param_group_id",
"current_index": "param_index",
"product_brand": "items.param_item_brand",
"product_category": "items.param_item_category",
"product_id": "items.param_item_id",
"product_list": "items.param_item_list",
"product_location_id": "items.param_item_location_id",
"product_name": "items.param_item_name",
"product_variant": "items.param_item_variant ",
"current_level": "event.param_level",
"most_recent_location": "event.param_location",
"campaign_medium": "event.param_medium",
"number_nights": "event.param_number_nights",
"number_pax": "event.param_number_pax",
"number_rooms": "event.param_number_rooms",
"travel_origin": "event.param_origin",
"product_unit_price": "items.param_price",
"product_quantity": "items.param_quantity",
"score": "event.param_score",
"search_keyword": "event.param_search_term",
"order_shipping_amount": "event.param_shipping",
"signup_method": "event.param_signup_method",
"campaign_source": "event.param_source",
"start_date": "event.param_start_date",
"order_tax_amount": "event.param_tax",
"product_term": "event.param_term",
"order_id": "event.param_transaction_id",
"travel_class": "event.param_travel_class",
"order_total": "event.param_value",
"currency_type": "event.param_virtual_currency_name",
"user_signup_method": "event.param_user_signup_method",
"tealium_event": "firebase_event_name",
"screen_name": "firebase_screen_name",
"screen_class": "firebase_screen_class",
"username": "firebase_property_name, firebase_property_value",
"customer_id": "firebase_user_id"
},
"commands": {
"launch": "config",
"user_login": "setuserproperty, setuserid",
"share": "logevent",
"show_offers": "logevent",
"join_group": "logevent",
"travel_order": "logevent",
"earn_currency": "logevent",
"spend_currency": "logevent",
"unlock_achievement": "logevent",
"level_up": "logevent",
"start_tutorial": "logevent",
"stop_tutorial": "logevent",
"record_score": "logevent",
"category": "logevent",
"product": "logevent",
"cart_add": "logevent",
"wishlist_add": "logevent",
"checkout": "logevent",
"checkout_progress": "logevent",
"email_signup": "logevent",
"order": "logevent",
"screen_view" : "setscreenname",
"order_basket" : "logevent",
"reset_data" : "resetdata"
}
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/tealium/example/EcommerceActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

updateBasket();

TealiumHelper.trackScreen(this, "Shop");
TealiumHelper.trackScreen(this, "shop");
}

@Override
Expand All @@ -58,13 +58,13 @@ public void onClick(View view) {
switch (id) {
case R.id.btn_ecom_category_view:
data.put(DataLayer.PRODUCT_CATEGORY, product.getProductCategory());
TealiumHelper.trackView("category", data);
TealiumHelper.trackEvent("category", data);
break;
case R.id.btn_ecom_product_view:
data.put(DataLayer.PRODUCT_ID, product.getProductId());
data.put(DataLayer.PRODUCT_NAME, product.getProductName());
data.put(DataLayer.PRODUCT_CATEGORY, product.getProductCategory());
TealiumHelper.trackView("product", data);
TealiumHelper.trackEvent("product", data);
break;
case R.id.btn_ecom_cart_add:
data.put(DataLayer.PRODUCT_ID, product.getProductId());
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/tealium/example/UserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

TealiumHelper.trackScreen(this, "User Details");
}

@Override
public void onClick(View view) {
if (view.getId() == R.id.btn_set_user_id) {
Expand Down
170 changes: 0 additions & 170 deletions app/src/main/java/com/tealium/example/helper/TealiumHelper.java

This file was deleted.

Loading

0 comments on commit 6078722

Please sign in to comment.