This article includes documentation for the new Dynamic Yield Shopify app, released in April 2023. For information on the previous version of the app, which will be supported until January 2024, see Implementing Dynamic Yield on your Shopify Store [Legacy].
The Dynamic Yield Shopify app enables you to quickly implement Dynamic Yield on your Shopify website. The Dynamic Yield app sets up:
- Dynamic Yield scripts and page context on every page
- e-commerce events (Purchase, Add to cart, Signup, Login, Newsletter subscription, Remove from cart, Sync cart content, Change attribute, Search)
- Active cookie consent, if you want to enable it.
- Product feed sync to Dynamic Yield
When you implement Dynamic Yield with the plugin, you can't change the events, script, context, and cookie consent implementation. These are standardized and managed by the app. If, for any reason, you want more control over these aspects of the implementation, consider not implementing Dynamic Yield with the app.
The app is compatible with every version and every theme of Shopify Online (web stores only).
Configure the app
First, install the Dynamic Yield app from your Shopify store:
https://apps.shopify.com/dynamic-yield-v2
Now, on the app page, implement Dynamic Yield on your site:
- Paste your Dynamic Yield section ID. The section ID is a 7-digit number that appears in the URL of any page in the Dynamic Yield console, starting with 8 or 9.
- Enable DY Embed Block in your theme.
That’s it. Now, the Dynamic Yield script and page context run on every page of your store, and e-commerce events are fired when users make purchases, add products to the cart, and so on.
Consent to cookies
Active Cookie Consent means you can serve personalized experiences to those customers who indicated that they consent to cookies (and non-personalized experiences to those who did not actively consent). The app automatically runs the code snippet that's required to indicate Active Cookie Consent. The consent status is not managed by the app or by Dynamic Yield. The app reads it directly from the Shopify native Customer API.
Sync your product catalog with Dynamic Yield
A synced product feed enables capabilities like recommendations, segmenting based on product engagement, social proof tactics, and more.
To enable the sync, you must enter the AWS S3 access and secret keys. To get these credentials:
- Go to the Dynamic Yield console.
- Click Assets, and then click Data Feeds.
- Click Add New to create a new Product Feed. If you already have a Product Feed, you'll need to edit it.
- In the Feed Source, choose Sync a file via Amazon S3.
- Click Create a bucket. The Access Key and Secret Key are displayed.
- Copy these credentials and paste them into the Shopify App configuration:
- Click Sync Entire Catalog Now. From now on, the feed will be synced every 6 hours.
Product feed columns
You can choose what to sync to Dynamic Yield. You can use the product attributes that you sync in translations, rules in recommendation strategies, targeting based on engagement with these product attributes, and more. You can decide if you want to sync the following:
- The mandatory column, as well as descriptions and keywords:
Product Feed Column Shopify Attribute sku variant.id group_id product_id name title url onlineStorePreviewUrl image_url featuredImage?.urlprice variant.price categories collection_joined_titlesin_stock variant.availableForSaledescription descriptionkeywords tags.join - Custom: You decide which columns to onboard. In this mode, you must provide JavaScript code to transform any information from the Shopify Product Object into a flat CSV that is generated periodically and synced with Dynamic Yield. While you input the code, you can click Download Preview File to see the result of your code in JSON format. Click the gear icon or select the product ID to preview the parsing on a specific product.
You can use the information that exists in Shopify's object (product object, variant object, and collection object). See below the full list of product attributes you can use:
products [
{
id
status
title
description
handle
onlineStorePreviewUrl
onlineStoreUrl
hasOnlyDefaultVariant
hasOutOfStockVariants
giftCardTemplateSuffix
publishedAt
requiresSellingPlan
totalInventory
totalVariants
tracksInventory
updatedAt
vendor
isGiftCard
productType
tags
product_{lng_code} [
{
locale
key
value
regions []
}
]
featuredImage {
id
altText
url
}
images(first: 50) [
{
id
altText
url
}
]
options [
{
name
position
values
option_{lng_code} [
{
locale
key
value
}
]
}
]
collections(first: 50) [
{
id
title
handle
image {
id
url
altText
}
description
productsCount
collection_{lng_code} [
{
locale
key
value
regions []
}
]
}
]
variants [
{
id
title
displayName
availableForSale
price
sku
taxable
taxCode
weight
weightUnit
compareAtPrice
inventoryQuantity
sellableOnlineQuantity
position
image{
url
altText
}
selectedOptions [
{
name
value
}
]
variant_{lng_code} [
{
locale
key
value
regions []
}
]
}
]
metafields [
{
namespace
value
description
type
key
}
]
}
]
function parser(data) {
const result = [];
data?.forEach((product) => {
const {
variants,
product_id,
onlineStorePreviewUrl,
title,
featuredImage,
description,
tags,
collections,
product_translations,
} = product;
const translations = product_translations?.map((translation) => {
const key = `lng:${translation.lng}:${translation.key}`;
return { [key]: translation.value };
});
const collection_joined_titles = collections
.map((item) => item.title)
.join("|");
variants.forEach((variant) => {
const dy_object = {
sku: variant.id,
group_id: product_id,
url: onlineStorePreviewUrl,
name: title,
price: variant.price,
in_stock: variant.availableForSale,
image_url: featuredImage?.url || "null",
categories: collection_joined_titles || "null",
description: description,
keywords: tags.join("|"),
};
const combined_translations = Object.assign(
{},
dy_object,
...translations
);
result.push(combined_translations);
});
});
return result;
}
function parser(data) {
const result = [];
data?.forEach((product) => {
const {
variants,
product_id,
onlineStorePreviewUrl,
title,
featuredImage,
description,
tags,
collections
} = product;
const collection_joined_titles = collections
.map((item) => item.title)
.join("|");
variants.forEach((variant) => {
const dy_object = {
sku: variant.id,
group_id: product_id,
url: onlineStorePreviewUrl,
name: title,
price: variant.price,
in_stock: variant.availableForSale,
image_url: featuredImage?.url || "null",
categories: collection_joined_titles || "null",
description: description,
keywords: tags.join("|"),
size: variant.option2
};
const combined_translations = Object.assign(
{},
dy_object,
...translations
);
result.push(combined_translations);
});
});
return result;
}