Expand my Community achievements bar.

SOLVED

AA - Product String Builder Errors

Avatar

Level 2

Anyone gotten the Launch AA Product String Builder to work without their Data Layer management tool??  I just tested it on Adobe's AEM we.retail demo site and either it won't recognize a direct object reference (like typing digitalData.cart.products instead of using a data element) or if I use a data element throws a runtime error.

 

launch-54a7599c3ecf-development.min.js:3 Uncaught (in promise) TypeError: this.settings.productCollectionPath.replace is not a function
    at n.getProductCollectionPath (launch-54a7599c3ecf-development.min.js:3)
    at n.setProductBase (launch-54a7599c3ecf-development.min.js:3)
    at n.buildProductMapping (launch-54a7599c3ecf-development.min.js:3)
    at launch-54a7599c3ecf-development.min.js:3

 

Sometimes it will recognize the data layer; when it does - the error above is thrown.

jayj13954773_0-1630803799035.png

 

1 Accepted Solution

Avatar

Correct answer by
Employee

If you are using the data element definition as:

atusingh_0-1631038473635.png

and using the data element as below:

atusingh_1-1631038538609.png

It should work.
If it still doesn't work, I suspect, if the data layer is being overwritten by the time code runs ?

View solution in original post

7 Replies

Avatar

Employee

Hi @ExpCloudMember 

 

For the error you're facing, could you please share the value you're passing to AA product string extension ?

 

I believe you're using Search discovery extension to set products variable.

Ideally, the way you pass values to "AA Product String Builder" in rule action as-

 

Root Data Object = Dataelement (which return root object, for example: dataLayerRoot)

Product Collection Path = cart.products

Product Strings Core Settings:
Category = product

Product ID = productsku

 

Avatar

Community Advisor

Try this:

1. Use %dataLayerRoot.cart% as the Root Data Object.

2. Use "products" as the Product Collection Path.

You will need a data element named "dataLayerRoot.cart" of JavaScript variable type to return your "dataLayerRoot.cart" object for step 1.

Avatar

Level 2

Tried a number of variations without success; either I still get the error in the original screenshot, it fails silently or the products string is malformed.  Simple Data Layer below:

 

digitalData.cart.products[0].product
digitalData.cart.products[0].price
digitalData.cart.products[0].quantity
digitalData.cart.products[1].product
digitalData.cart.products[1].price
digitalData.cart.products[1].quantity

The documentation from the extension says it's expecting "digitalData" in the root, "cart.products" in the Product Collection path and "product" in Path to Product ID box.

 

jayj13954773_0-1631033486286.png

 

Except, that doesn't work for me.  Unless I'm doing it incorrectly, the extension tracks "_0" as the product id (you can see the actual id in the original screenshot).

jayj13954773_2-1631034368016.png

 

 

jayj13954773_1-1631034304558.png

 

Avatar

Employee

@ExpCloudMember  Can you share the definition within digitalData data-element, that you're using in Root ?

Avatar

Level 2

Core > JavaScript Variable returns "digitalData"

Avatar

Correct answer by
Employee

If you are using the data element definition as:

atusingh_0-1631038473635.png

and using the data element as below:

atusingh_1-1631038538609.png

It should work.
If it still doesn't work, I suspect, if the data layer is being overwritten by the time code runs ?

Avatar

Level 2

No, the DL is still present and not over-written by the time this Rule runs (set at page bottom).  I agree with you, it "should" work - but it doesn't. My screenshot looks exactly like yours.