Understanding the Limitations of SDK Events
SDK events like Add To Cart are predefined and cannot be modified to include custom attributes. This limitation requires alternative solutions to capture the necessary information.
Using ProfileObjects to Capture Custom Attributes
ProfileObjects can be used to add custom attributes to a customer’s profile. When a product is added to the cart, you can send the product size as a user attribute using profileObjects. This allows you to capture the customer’s affinity for specific product sizes.
example.js
// Example of sending product size as a user attribute
const userProfile = {
"productSize": "Large"
};
// Send the user profile with the custom attribute
sendProfile(userProfile);
The root cause of this issue is the limitation of SDK events, which cannot be customized to include additional attributes. This requires the use of alternative solutions, such as profileObjects, to capture the necessary information.
Implementation and Best Practices
To implement this solution, you can follow these best practices:
Checklist for Capturing Custom Attributes
- Use profileObjects to add custom attributes to a customer’s profile.
- Send the product size as a user attribute when a product is added to the cart.
- Utilize the Web SDK events to capture the customer’s interactions.
- Ensure that the custom attributes are properly configured and sent to Marketing Cloud.
- Test and verify that the custom attributes are being captured correctly.
Additionally, consider the following FAQs:
What is the purpose of using profileObjects?
ProfileObjects are used to add custom attributes to a customer’s profile, allowing you to capture additional information about the customer.
Can I customize SDK events to include custom attributes?
No, certain SDK events, like Add To Cart, cannot be customized to include additional attributes.
How do I send custom attributes using profileObjects?
You can send custom attributes by creating a user profile with the desired attributes and sending it using the sendProfile function.
What are the benefits of capturing custom attributes?
Capturing custom attributes allows you to gain a deeper understanding of your customers’ preferences and behaviors, enabling you to create more personalized and effective marketing campaigns.
Need help shipping this in production?
Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.