Skip to content

Commit

Permalink
Added new statuses on a product
Browse files Browse the repository at this point in the history
  • Loading branch information
semsudin-tafilovic committed Nov 7, 2023
1 parent 593762e commit 3133350
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 107 deletions.
2 changes: 1 addition & 1 deletion android-sdk/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#
# LIBRARY_VERSION=5.1.4.3 (hotfixes are included on this variable)
#
LIBRARY_VERSION=5.1.6.2
LIBRARY_VERSION=5.1.7
BINTRAY_REPO=webtrekk-android-sdk
BINRTAY_NAME=webtrekk-android-sdk
PUBLISHED_GROUP_ID=com.mapp.sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,15 @@ data class ECommerceParameters
constructor(
var customParameters: Map<Int, String> = emptyMap()
) : BaseEvent {
enum class Status {
NONE_STATUS,
ADDED_TO_BASKET,
PURCHASED,
VIEWED;

fun toStatus(): String {
return when (this) {
ADDED_TO_BASKET -> "add"
PURCHASED -> "conf"
VIEWED -> "view"
NONE_STATUS -> ""
}
}
enum class Status(val value:String) {
NONE_STATUS(""),
ADDED_TO_BASKET("add"),
PURCHASED("conf"),
VIEWED("view"),
DELETED_FROM_BASKET("del"),
ADDED_TO_WISHLIST("add-wl"),
DELETED_FROM_WISHLIST("del-wl"),
CHECKOUT("checkout");
}

var products = listOf<ProductParameters>()
Expand Down Expand Up @@ -56,7 +51,7 @@ constructor(
map.addNotNull(ECommerceParam.PRODUCT_CURRENCY, currency)
map.addNotNull(ECommerceParam.ORDER_ID, orderID)
map.addNotNull(ECommerceParam.ORDER_VALUE, orderValue)
map.addNotNull(ECommerceParam.STATUS_OF_SHOPPING_CARD, status.toStatus())
map.addNotNull(ECommerceParam.STATUS_OF_SHOPPING_CARD, status.value)
map.addNotNull(ECommerceParam.RETURNING_OR_NEW_CUSTOMER, returningOrNewCustomer)
map.addNotNull(ECommerceParam.RETURN_VALUE, returnValue)
map.addNotNull(ECommerceParam.CANCELLATION_VALUE, cancellationValue)
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 01 14:07:33 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
6 changes: 3 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ android {
minSdkVersion versions.minSdkVersion
targetSdkVersion versions.targetSdkVersion
versionCode 5
versionName "1.0.8"
versionName "1.0.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "DOMEIN", "\"" + getTrackDomain() + "\""
buildConfigField "String", "TRACK_IDS", "\"" + getTrackIds() + "\""
Expand Down Expand Up @@ -106,7 +106,7 @@ android {
}

dependencies {
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation('com.google.android.material:material:1.9.0')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$versions.kotlinVersion"
Expand All @@ -122,7 +122,7 @@ dependencies {
implementation('com.google.firebase:firebase-messaging')
implementation("com.google.firebase:firebase-crashlytics")

implementation('com.mapp.sdk:mapp-android:6.0.20')
implementation('com.mapp.sdk:mapp-android:6.0.20.1')

implementation(project(':android-sdk'))
//implementation ("com.mapp.sdk:intelligence-android:5.1.6.1")
Expand Down
1 change: 1 addition & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
<activity
android:name=".mapp.UserMatchingActivity"
android:exported="false" />
<activity android:name=".ObjectTrackingProductStatus" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.appoxee.Appoxee
import com.example.webtrekk.androidsdk.mapp.PageRequestsActivity
import com.example.webtrekk.androidsdk.mapp.UserMatchingActivity
import com.example.webtrekk.androidsdk.tracking.OrdersTrackingActivity
import kotlinx.android.synthetic.main.activity_main.btnObjectTrackingProductStatus
import kotlinx.android.synthetic.main.activity_main.btnResetSdk
import kotlinx.android.synthetic.main.activity_main.button10
import kotlinx.android.synthetic.main.activity_main.button4
Expand Down Expand Up @@ -146,6 +147,11 @@ class MainActivity : AppCompatActivity() {
startActivity(intent)
}

btnObjectTrackingProductStatus.setOnClickListener {
val intent=Intent(this, ObjectTrackingProductStatus::class.java)
startActivity(intent)
}

btnResetSdk.setOnClickListener {
ResetDialog.getInstance(object : ResetCallback {
override fun resetOnly() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import kotlinx.android.synthetic.main.activity_object_tracking.btnTrackCustomECo
import kotlinx.android.synthetic.main.activity_object_tracking.button_test_anonymous_tracking
import kotlinx.android.synthetic.main.activity_object_tracking.example10
import kotlinx.android.synthetic.main.activity_object_tracking.example3
import kotlinx.android.synthetic.main.activity_object_tracking.example4
import kotlinx.android.synthetic.main.activity_object_tracking.example5
import kotlinx.android.synthetic.main.activity_object_tracking.example6
import kotlinx.android.synthetic.main.activity_object_tracking.example7
import kotlinx.android.synthetic.main.activity_object_tracking.example8
Expand Down Expand Up @@ -46,12 +44,7 @@ class ObjectTrackingActivityExample : AppCompatActivity() {
example3.setOnClickListener {
trackGoal()
}
example4.setOnClickListener {
trackEcommerceViewProduct()
}
example5.setOnClickListener {
trackEcommerceAddedToBasket()
}

example6.setOnClickListener {
trackEcommerceConfirmation()
}
Expand Down Expand Up @@ -208,65 +201,6 @@ class ObjectTrackingActivityExample : AppCompatActivity() {
Webtrekk.getInstance().trackPage(pageEvent)
}


private fun trackEcommerceViewProduct() {

val ecommerceParameters1 = ECommerceParameters(
customParameters = mapOf(
1 to "ProductParam1",
2 to "ProductParam2"
)
)
ecommerceParameters1.products = listOf(product1)
ecommerceParameters1.status = ECommerceParameters.Status.VIEWED
ecommerceParameters1.cancellationValue = 2
ecommerceParameters1.couponValue = 33
ecommerceParameters1.currency = "EUR"
ecommerceParameters1.markUp = 1
ecommerceParameters1.orderStatus = "order received"
ecommerceParameters1.orderID = "ud679adn"
ecommerceParameters1.orderValue = 456
ecommerceParameters1.paymentMethod = "credit card"
ecommerceParameters1.returnValue = 3
ecommerceParameters1.returningOrNewCustomer = "new customer"
ecommerceParameters1.shippingCost = 35
ecommerceParameters1.shippingSpeed = "highest"
ecommerceParameters1.shippingServiceProvider = "DHL"

val pageEvent = PageViewEvent(name = "TrackProductView")
pageEvent.eCommerceParameters = ecommerceParameters1

Webtrekk.getInstance().trackPage(pageEvent)

ecommerceParameters1.products = listOf(product2)
Webtrekk.getInstance().trackPage(pageEvent)
}

private fun trackEcommerceAddedToBasket() {

val ecommerceParameters1 = ECommerceParameters(
customParameters = mapOf(
1 to "ProductParam1",
2 to "ProductParam2"
)
)
product1.quantity = 3
product2.quantity = 2

ecommerceParameters1.status = ECommerceParameters.Status.ADDED_TO_BASKET
ecommerceParameters1.products = listOf(product1)

val pageEvent = PageViewEvent(name = "TrackProductAddedToBasket")
pageEvent.eCommerceParameters = ecommerceParameters1


Webtrekk.getInstance().trackPage(pageEvent)

ecommerceParameters1.products = listOf(product2)

Webtrekk.getInstance().trackPage(pageEvent)
}

private fun trackEcommerceConfirmation() {

product1.quantity = 3
Expand Down
Loading

0 comments on commit 3133350

Please sign in to comment.