Merge pull request #12047 from zfox23/commerce_dataTracking3

Commerce Data Tracking: Iteration 3 (Purchases)
This commit is contained in:
Zach Fox 2017-12-22 14:31:03 -08:00 committed by GitHub
commit 808b9cbc31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 7 deletions

View file

@ -33,6 +33,7 @@ Rectangle {
property string itemName; property string itemName;
property string itemId; property string itemId;
property string itemHref; property string itemHref;
property string itemAuthor;
property double balanceAfterPurchase; property double balanceAfterPurchase;
property bool alreadyOwned: false; property bool alreadyOwned: false;
property int itemPrice: -1; property int itemPrice: -1;
@ -81,12 +82,12 @@ Rectangle {
if (result.status !== 'success') { if (result.status !== 'success') {
failureErrorText.text = result.message; failureErrorText.text = result.message;
root.activeView = "checkoutFailure"; root.activeView = "checkoutFailure";
UserActivityLogger.commercePurchaseFailure(root.itemId, root.itemPrice, !root.alreadyOwned, result.message); UserActivityLogger.commercePurchaseFailure(root.itemId, root.itemAuthor, root.itemPrice, !root.alreadyOwned, result.message);
} else { } else {
root.itemHref = result.data.download_url; root.itemHref = result.data.download_url;
root.isWearable = result.data.categories.indexOf("Wearables") > -1; root.isWearable = result.data.categories.indexOf("Wearables") > -1;
root.activeView = "checkoutSuccess"; root.activeView = "checkoutSuccess";
UserActivityLogger.commercePurchaseSuccess(root.itemId, root.itemPrice, !root.alreadyOwned); UserActivityLogger.commercePurchaseSuccess(root.itemId, root.itemAuthor, root.itemPrice, !root.alreadyOwned);
} }
} }
@ -880,6 +881,7 @@ Rectangle {
root.itemPrice = message.params.itemPrice; root.itemPrice = message.params.itemPrice;
itemHref = message.params.itemHref; itemHref = message.params.itemHref;
referrer = message.params.referrer; referrer = message.params.referrer;
itemAuthor = message.params.itemAuthor;
setBuyText(); setBuyText();
break; break;
default: default:

View file

@ -89,17 +89,19 @@ void UserActivityLoggerScriptingInterface::doLogAction(QString action, QJsonObje
Q_ARG(QJsonObject, details)); Q_ARG(QJsonObject, details));
} }
void UserActivityLoggerScriptingInterface::commercePurchaseSuccess(QString marketplaceID, int cost, bool firstPurchaseOfThisItem) { void UserActivityLoggerScriptingInterface::commercePurchaseSuccess(QString marketplaceID, QString contentCreator, int cost, bool firstPurchaseOfThisItem) {
QJsonObject payload; QJsonObject payload;
payload["marketplaceID"] = marketplaceID; payload["marketplaceID"] = marketplaceID;
payload["contentCreator"] = contentCreator;
payload["cost"] = cost; payload["cost"] = cost;
payload["firstPurchaseOfThisItem"] = firstPurchaseOfThisItem; payload["firstPurchaseOfThisItem"] = firstPurchaseOfThisItem;
doLogAction("commercePurchaseSuccess", payload); doLogAction("commercePurchaseSuccess", payload);
} }
void UserActivityLoggerScriptingInterface::commercePurchaseFailure(QString marketplaceID, int cost, bool firstPurchaseOfThisItem, QString errorDetails) { void UserActivityLoggerScriptingInterface::commercePurchaseFailure(QString marketplaceID, QString contentCreator, int cost, bool firstPurchaseOfThisItem, QString errorDetails) {
QJsonObject payload; QJsonObject payload;
payload["marketplaceID"] = marketplaceID; payload["marketplaceID"] = marketplaceID;
payload["contentCreator"] = contentCreator;
payload["cost"] = cost; payload["cost"] = cost;
payload["firstPurchaseOfThisItem"] = firstPurchaseOfThisItem; payload["firstPurchaseOfThisItem"] = firstPurchaseOfThisItem;
payload["errorDetails"] = errorDetails; payload["errorDetails"] = errorDetails;

View file

@ -33,8 +33,8 @@ public:
Q_INVOKABLE void bubbleToggled(bool newValue); Q_INVOKABLE void bubbleToggled(bool newValue);
Q_INVOKABLE void bubbleActivated(); Q_INVOKABLE void bubbleActivated();
Q_INVOKABLE void logAction(QString action, QVariantMap details = QVariantMap{}); Q_INVOKABLE void logAction(QString action, QVariantMap details = QVariantMap{});
Q_INVOKABLE void commercePurchaseSuccess(QString marketplaceID, int cost, bool firstPurchaseOfThisItem); Q_INVOKABLE void commercePurchaseSuccess(QString marketplaceID, QString contentCreator, int cost, bool firstPurchaseOfThisItem);
Q_INVOKABLE void commercePurchaseFailure(QString marketplaceID, int cost, bool firstPurchaseOfThisItem, QString errorDetails); Q_INVOKABLE void commercePurchaseFailure(QString marketplaceID, QString contentCreator, int cost, bool firstPurchaseOfThisItem, QString errorDetails);
Q_INVOKABLE void commerceEntityRezzed(QString marketplaceID, QString source, QString type); Q_INVOKABLE void commerceEntityRezzed(QString marketplaceID, QString source, QString type);
Q_INVOKABLE void commerceWalletSetupStarted(int timestamp, QString setupAttemptID, int setupFlowVersion, QString referrer, QString currentDomain); Q_INVOKABLE void commerceWalletSetupStarted(int timestamp, QString setupAttemptID, int setupFlowVersion, QString referrer, QString currentDomain);
Q_INVOKABLE void commerceWalletSetupProgress(int timestamp, QString setupAttemptID, int secondsElapsed, int currentStepNumber, QString currentStepName); Q_INVOKABLE void commerceWalletSetupProgress(int timestamp, QString setupAttemptID, int secondsElapsed, int currentStepNumber, QString currentStepName);

View file

@ -250,7 +250,8 @@
itemName: name, itemName: name,
itemPrice: price ? parseInt(price, 10) : 0, itemPrice: price ? parseInt(price, 10) : 0,
itemHref: href, itemHref: href,
referrer: referrer referrer: referrer,
itemAuthor: author
})); }));
} }