Expand my Community achievements bar.

SOLVED

Adobe ACP Mobile SDK - "&&& product" context data implementation

Avatar

Level 2

I have a ACP mobile sdk implementation using trackState and trackAction calls. Now the devs are sending data using "&&products": ";Category: infinite;Product: 160GB, Talk & Text - Plus;Quantity: 1;Price: 75.0". How do i populate it up in Adobe analytics? I tried mapping it to an eVar using processing rules but when in context data variable i typed : &&products it turned the value into products and it is not working. 

 

Please Suggest me the best solution as it is urgent 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor and Adobe Champion

Yes, if the event is a purchase, pass &&events=purchase, if it's an "add to cart" pass &&events=scAdd

 

If you have custom events (ones that aren't merchandising, but are sent on the same action, then you will want your devs to add those:

 

&&events=purchase,event1

 

For example.

 

 

Other events, that you can determine with processing rules can stay in your processing rules.... so I have our devs code the specific events for s.products, and use Processing Rules for the other events... they will work together. 

 

But since you cannot see or read what is happening in s.products in processing rules, your developers should implement it, to make sure everything is clean.

View solution in original post

19 Replies

Avatar

Employee

Not sure what AEC mobile SDK is, as we only have AEP and ACP SDK for Adobe Analytics. In case you're using native Android/iOS SDK you can follow this document - https://developer.adobe.com/client-sdks/solution/adobe-analytics/product-variable/

products is set directly on the image request and auto-mapped as far as I know in the above approach, and the other variables are set as context data.

Avatar

Level 2

i am not the receiving the data that the devs are passing:

 

Value passed:

 

 "&&products": ";Category: infinite;Product: 160GB, Talk & Text - Plus;Quantity: 1;Price: 75.0"

 

Value received for Android: 160 GB

No value received for iOS

Avatar

Employee

It should be in this format- 

 

cdata.put("&&products", "Category;Product;Quantity;Price[,Category;Product;Quantity;Price]");
'Here's the sample:
//create a context data dictionary
HashMap cdata = new HashMap<String, String>();
// add products, a purchase id, a purchase context data key, and any other data you want to collect.
// Note the special syntax for products
cdata.put("&&products", ";Running Shoes;1;69.95,;Running Socks;10;29.99"); //This one is sending multiple products.

cdata.put("myapp.purchase", "1");
cdata.put("myapp.purchaseid", "1234567890");
// send the tracking call - use either a trackAction or trackState call.
// trackAction example:
MobileCore.trackAction("purchase", cdata);
// trackState example:
MobileCore.trackState("Order Confirmation", cdata);
For iOS:

//create a context data dictionary
var contextData = [String: Any]() 

// add products, a purchase id, a purchase context data key, and any other data you want to collect.
// Note the special syntax for products
contextData["&&products"] = ";Running Shoes;1;69.95,;Running Socks;10;29.99"
contextData["m.purchaseid"] = "1234567890"
contextData["m.purchase"] = "1"

// send the tracking call - use either a trackAction or trackState call.
// trackAction example:
MobileCore.track(action: "purchase" as String, data: contextData)
// trackState example:
MobileCore.track(state: "Order Confirmation", data: contextData)

Can you please double check this? I doubt your syntax is correct. I think there shouldn't be ; before Category.

Avatar

Level 2

Sure, i can check that. Also qq, i saw this note in the documentation: "If you trigger a product-specific event by using the &&products variable, you must also set that event in the &&events variable. If you do not set that event, it is filtered out during processing"

 

I just checked with the iOS devs and they said they are not passing any &&events variable. Could this be an issue as well?

 

Avatar

Employee

Hey @jaishal No, I don't think so, because only event will be filtered out in that case. So, I think the syntax would be the problem. But if your team has validated the same and you still see an issue, please feel free to log a support ticket to us and we can check this further. Please do include the verbose logs when creating a ticket and setup detals.

Avatar

Community Advisor and Adobe Champion

So to add onto this conversation... We are still using ACP SDK.

 

There is no processing rules for products, this is why your products need to be sent directly, but they absolutely need to be the correct format in order for Adobe to parse the information correctly... or the entire thing will be thrown out as invalid.

 

The format you see for Web is the format you should see in your app:

https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/page-vars/products

 

So:

;Category: infinite;Product: 160GB, Talk & Text - Plus;Quantity: 1;Price: 75.0

 

Is wrong for many reasons... first, it should not start with ; (that indicates that the category value is empy...but you are expecting your category to be "Category: infinite" (not sure if you want the literal "Category:" there...  or maybe you are only adding it for readability here? But, if you are sending these prefixes, then this will cause some issues in your data).. and all other fields have been shifted by one place. Your Product Name is in the quantity slot, your quantity is in the price, your price is in your custom events....

 

You cannot have a comma in your Product Identifier like that... "Product: 160GB, Talk & Text - Plus", Products is a complex list... comma is the separator between products, semi-colon is the separator between the parts of the Product notation (category, product, quantity, price, merch events and merch eVars)... so that comma, placed where it is, is telling Adobe to move to the next product. The ampersand is also going to cause issues as this is a reserved character for saying "next param"... I believe both will need to be URL encoded.

 

Next, you cannot prefix your quantity and price with text like that.... only numerical values are expected here.

 

As for custom events, you aren't using any, but because this is a purchase, and quantity and price are only read by Adobe in the presence of the "purchase" event, even IF the above was well formed... you would only get the Category and Product, but no Revenue (which would be ignored without purchase).

 

 

based on your above, I would expect the final output to be something like:

&&product=infinite;160GB%2C Talk %26 Text - Plus;1;75.0&&events=purchase

(notice that I encoded both your comma and your ampersand to keep both of these from breaking the string - comma will break the way products processes the data, & will be treated like a whole new passed param)

 

I only passed the purchase event, but IF you had any custom events in the product notation, they would also need to be passed... something like:

&&product=infinite;160GB%2C Talk %26 Text - Plus;1;75.0;event1=1&&events=purchase,event1

 

Once you are sending the product information in the correct format, it will go straight into Adobe, there is no processing rules required.

 

I hope this helps, good luck

Avatar

Level 2

Thanks jennifer for the response.

In Adobe documentation https://developer.adobe.com/client-sdks/solution/adobe-analytics/product-variable/

It is said under Swift(iOS):

 

contextData["&&products"] =  ";Running Shoes;1;69.95;event1=5.5;eVar1=Merchandising,;Running Socks;10;29.99"
So you said, before category there should be ";" but in the documentation it is said to use. Can you enlighten which is the correct format?
 
 
 
 
 

 

 

 

Avatar

Community Advisor and Adobe Champion

The documentation is actually correct... it's just that they left out the optional category.. hence starting with ; instead of text. 

 

In your example, you are passing a category, so that needs to be the first value... but category is optional... in fact, everything except the Product Identifier is optional.

 

 

You will also notice that nothing in that notation has prefix text (same as the information I provided), my example is the same as the documentation, but with more of the optional fields provided to match up to your original ask

 

Going back to the documentation sample; when reading:

";Running Shoes;1;69.95;event1=5.5;eVar1=Merchandising,;Running Socks;10;29.99"

 

You would read this as:

 

Product 1:

  • Category = null
  • Product = Running Shoes
  • Quantity = 1
  • Price = 69.95
  • events
    • event1=5.5 (numerically passing "5.5" as the incrementor)
  • merchandising eVar(s)
    • eVar1=Merchandising (passing a literal "Merchandising" value)

 

Product 2:

  • Category = null
  • Product = Running Socks
  • Quantity = 10
  • Price = 29.99
  • events = null
  • Merchandising eVars = null

 

 

 

When it comes to the optional field, Category is not mandatory, but I like it because I use Products list for 20 different things (not all related to purchases) due to the ability to have merchandising elements...  I use Category to denote the use as opposed to an actual category for the product.... but in a simpler implementation like yours, I might use category for actual product related data.

 

Quantity and Price should only exist on a purchase (and even then, it's only needed IF you want your Revenue Report to work... you can make a purchase without these), and neither Merchandising Events or eVars are mandatory...

 

But if you are sending those values, they need to be formatted correctly, and sent in the proper notation.

Avatar

Level 2

Thanks for the response jennifer.

Also wanted to confirm if i want to get Product ID(SOC ID) as well along with category, product, category, price. How it needs to be parsed as it is available from an API respons.e 

On web, we are getting this value this value under Products: IP16PM256GLD:iPhone 16 Pro Max 256GB Desert Titanium

How do we get this value in App under Products?

 

Avatar

Community Advisor and Adobe Champion

So in Workspace, when you look at Products, are you seeing "IP16PM256GLD:iPhone 16 Pro Max 256GB Desert Titanium"?

 

If so that is just the Product Identifier (i.e. the second part of the products notation)

 

If that is the case, it looks like your implementation combined the "ID" and the "Name/Description" all into the Product Identifier, rather than using something like Merchandising eVars... Or is that the Merchandising eVar?

 

If you want something to match your website data, you should look at your website... the formatting is the same... it's just pushed slightly differently (using app coding and using &&products in the URL string)... but the actual data, that is the same.

Avatar

Level 2

So yes that is correct, web does combine the ID and Product Name as you mentioned by providing the fix using Adobe Launch. but since we do not use adobe launch for App. My questions is to get the ID value in "&&products", what should be the format? Also is it something that needs to be passed in a new eVAR or can be passed in "&&products" itself? 

Avatar

Community Advisor and Adobe Champion

It can still be passed in Products the same way... except that your developers have to code it, you can't use Launch or processing rules to combine the values...

 

So you will have to document the exact formatting, and provide that to your app developers so that they can create the product identifiers the way you need them, and to add it to the Purchase event using the &&products.

 

So if you want IP16PM256GLD:iPhone 16 Pro Max 256GB Desert Titanium you will have to instruct your developers which fields to pull this data from, so that they can code:

contextData["&&products"] = "infinite;IP16PM256GLD:iPhone 16 Pro Max 256GB Desert Titanium;1;75.0"

 

Avatar

Level 2

Okay thanks for this so to confirm, if i have to get the value in &&products with all values as:

Category: wireless

ID:XXNM012TN

Name: 160GB, Talk & Text - Plus

Quantity:1

Price: 75

is this correct syntax ?

contextData["&&products"] = "wireless;XXNM012TN;160GB%2C Talk %26 Text - Plus;1;75.0"

 or

 

contextData["&&products"] = "wireless;XXNM012TN:160GB%2C Talk %26 Text - Plus;1;75.0"

 

Avatar

Community Advisor and Adobe Champion

No, this won't work... every time you use a ; it goes to the next specific slot in the Products notation.... you now have your

 

Category = wireless

Product ID = XXNM012TN

Quantity = 160GB, Talk & Text - Plus (which is completely invalid and Adobe will throw this out)

Price = 1

Custom Events = 75 (which isn't in a proper event syntax, so it will break again)

 

 

Can you go to your website, using the Adobe Platform Debugger, or Omnibug, or your Network panel, whatever you feel comfortable testing with, and copy exactly what you are sending in Products?

 

 

The second one looks more correct... assuming you want "wireless" in your actual Category field...  at least that string won't break.... but I want to confirm that it matches your website.

Avatar

Level 2

On the website it looks like this:

 

;XXNM012TN:160GB Talk & Text - Plus;;;;eVar31=PPCExpress|eVar32=wireless|eVar33=plan|eVar145=0.00|eVar146=0.00|eVar147=0.00|eVar148=0.00

Avatar

Community Advisor and Adobe Champion

So that is what you need to match:

 

 

 

contextData["&&products"] = ";XXNM012TN:160GB Talk & Text - Plus;;;;eVar31=PPCExpress|eVar32=wireless|eVar33=plan|eVar145=0.00|eVar146=0.00|eVar147=0.00|eVar148=0.00"

 

 

 

  • Category = null (You are not using a category, so it can remain blank...)
  • Product = XXNM012TN:160GB Talk & Text - Plus
  • Quantity = null (You aren't passing a quantity, so that can be left empty)
  • Price = null (You aren't passing a price, so that can be left empty)
  • Custom Events = null (You aren't passing any events, so that can be left empty)
  • You are passing eVars, so all of those need to be set:
    • eVar31=PPCExpress
    • eVar32=wireless
    • eVar33=plan
    • eVar145=0.00
    • eVar146=0.00
    • eVar147=0.00
    • eVar148=0.00

 

Show your devs samples from your website... match the same exact format as your website in all the different contexts.

Avatar

Level 2

Thank you so much for this jennifer

 

Also is it mandatory to pass  "&&events=purchase" , if we have events.pageView or any custom events along with it?

Avatar

Correct answer by
Community Advisor and Adobe Champion

Yes, if the event is a purchase, pass &&events=purchase, if it's an "add to cart" pass &&events=scAdd

 

If you have custom events (ones that aren't merchandising, but are sent on the same action, then you will want your devs to add those:

 

&&events=purchase,event1

 

For example.

 

 

Other events, that you can determine with processing rules can stay in your processing rules.... so I have our devs code the specific events for s.products, and use Processing Rules for the other events... they will work together. 

 

But since you cannot see or read what is happening in s.products in processing rules, your developers should implement it, to make sure everything is clean.

Avatar

Level 2

So here are the steps we have, please confirm if these are corrects values and in correct syntax:

 

1. Product View:

contextData["&&products"] ="category;ID:Name;events.productView(passed by devs and set using processing rules)

2. Order Summary Page:

contextData["&&products"] ="category;ID:Name;events.productView,events.checkout or events.orderReview(passed by devs and set using processing rules)

3. Order Submission page (Purchase Page):

contextData["&&products"] ="category;ID:Name;Quantity;Price;events.purchase,events.productView

 

Let me know if my thinking is correct and thanks for all the help Jessifer