Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
VTEX IO Apps
Shopper experience
Affiliates Program
Official extension
Version: 1.8.4
Latest version: 1.8.4

Source code

This app is no longer maintained by VTEX. This means support and maintenance are no longer provided.

The Affiliates app enables your store to operate under a partner structure. The app creates affiliate stores that have an access page and a URL parameter for them to share with their clients. When something is purchased, a commission is generated for the client's purchase. The app also adds configuration and management pages for the store owner and affiliates.

{"base64":"  ","img":{"width":3112,"height":1826,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":2146587,"url":"https://user-images.githubusercontent.com/53904010/192868993-8967062b-b140-4d0e-95e1-b5c3c4e9f79a.png"}}

Example of an affiliate page

This is the main page that the affiliate will share with their clients. It's a page that can be customized to show some products and guide the customer.

{"base64":"  ","img":{"width":3580,"height":1084,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":341330,"url":"https://user-images.githubusercontent.com/53904010/192872539-184d5dee-01cc-46b4-a2b8-4d138e3b0b6c.png"}}

Example of the affiliate profile page

This is the page where the affiliate can view the orders associated with their account, with a totalizer and dashboard for a better experience.

{"base64":"  ","img":{"width":3578,"height":1436,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":373278,"url":"https://user-images.githubusercontent.com/53904010/192870484-72cfc8a0-f5bb-488e-8a7a-cda6c189affc.png"}}

Example of the affiliate form

This page contains a form that can be filled out by anyone who wants to become an affiliate

Configuration

  1. Search for the Affiliate app on our app store and install it on your account.
  2. Open your store's Store Theme app directory in your code editor.
  3. Add the Affiliates app to your theme's manifest.json file inside peerDependencies as shown below:

_10
"peerDependencies": {
_10
+ "vtex.affiliates": "1.x"
_10
}

The Affiliates app can export several theme blocks when added as a dependency. There are some responsible for creating several pages on the storefront, like affiliate, affiliate-profile, and affiliate-form, and several functionality blocks that will be used within these pages' context as well. We will show more about them in the advanced section.

  1. After installing the app, the main pages will be available with a default layout. You can access them by /affiliates/:slug and /affiliates/profile/:slug.
  2. If you want your affiliates to have the possibility to send any URL of the site for the client, you will have to add the affiliate-url-monitoring block into the header of your theme, as shown below:

_14
"header-layout.desktop": {
_14
"children": [
_14
+ "affiliate-url-monitoring",
_14
"flex-layout.row#1-desktop",
_14
"flex-layout.row#3-desktop",
_14
]
_14
},
_14
_14
"header-layout.mobile": {
_14
"children": [
_14
+ "affiliate-url-monitoring",
_14
"flex-layout.row#1-desktop",
_14
]
_14
},

_The affiliate_url_monitoring app adds a logic that will seek a specific parameter on the URL. If the parameter is found with a valid affiliate slug as its value, it will add the affiliate information to the purchase.

  1. Now your affiliate can send any URL with the parameter targeting with their slug as value, which will add the affiliate information to be linked to the purchase
Example URLBehavior
https://mystore.com/product/pJust a simple product URL
https://mystore.com/product/p?targeting=affiliateNameURL with the parameter, will link this client to the affiliate
  1. If you want to change the parameter that will be used for the affiliate to share, you can edit the parameter property from the Affiliate Monitoring block inside the Site Editor.
    {"base64":"  ","img":{"width":564,"height":474,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":65351,"url":"https://user-images.githubusercontent.com/53904010/191607498-a58c11ba-57f9-4d1c-aa65-b3d4c82c0c90.png"}}

    After the affiliate sends their URL for the client, their Affiliate ID will be linked to this client for some time and will be prioritized even if another Affiliate sends a URL to the same client. The Affiliate ID usually persists for 60 days.

Advanced configurations

According to the Affiliate app composition, the /affiliates/:slug page can be highly customizable using other blocks. Currently, its default implementation is as follows:

store.affiliates interface for the route /affiliates/:slug, store.affiliates-profile for the route affiliates/profile/:slug, and store.affiliate-form for the route affiliate/form.

store.affiliates


_63
{
_63
"store.affiliates": {
_63
"blocks": ["affiliate-validator"]
_63
},
_63
_63
"affiliate-validator": {
_63
"props": {
_63
"Valid": "affiliate-template",
_63
"Invalid": "affiliate-invalid-template"
_63
}
_63
},
_63
_63
"affiliate-template": {
_63
"children": [
_63
"affiliate-store-name",
_63
"flex-layout.row#banner",
_63
"affiliate-profile-button",
_63
"search-result-layout.customQuery#affiliate"
_63
]
_63
},
_63
_63
"flex-layout.row#banner": {
_63
"children": ["image#affiliate-banner"]
_63
},
_63
_63
"image#affiliate-banner": {
_63
"props": {
_63
"src": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/VTEX_Logo.svg/400px-VTEX_Logo.svg.png"
_63
}
_63
},
_63
_63
"search-result-layout.customQuery#affiliate": {
_63
"props": {
_63
"querySchema": {
_63
"skusFilter": "ALL_AVAILABLE",
_63
"simulationBehavior": "default",
_63
"queryField": "137",
_63
"mapField": "productClusterIds",
_63
"facetsBehavior": "Dynamic"
_63
}
_63
},
_63
"blocks": [
_63
"search-result-layout.desktop",
_63
"search-result-layout.mobile",
_63
"search-not-found-layout"
_63
]
_63
},
_63
_63
"affiliate-invalid-template": {
_63
"children": ["rich-text#invalid-affiliate"]
_63
},
_63
_63
"rich-text#invalid-affiliate": {
_63
"props": {
_63
"textAlignment": "CENTER",
_63
"textPosition": "CENTER",
_63
"text": "**Affiliate does not exist or has not been approved**",
_63
"font": "t-heading-1"
_63
}
_63
}
_63
_63
_63
}

store.affiliates-profile


_37
{
_37
"store.affiliates-profile": {
_37
"children": ["affiliate-profile"]
_37
},
_37
_37
"affiliate-profile": {
_37
"children": ["affiliate-profile-topbar", "affiliate-profile-validator"]
_37
},
_37
_37
"affiliate-profile-validator": {
_37
"props": {
_37
"Valid": "flex-layout.row#profile",
_37
"Invalid": "rich-text#profileerror"
_37
}
_37
},
_37
_37
"rich-text#profileerror": {
_37
"props": {
_37
"text": "### Faça o login com a conta correta do afiliado para acessar as informações",
_37
"textAlignment": "CENTER",
_37
"textPosition": "CENTER"
_37
}
_37
},
_37
_37
"flex-layout.row#profile": {
_37
"children": ["flex-layout.col#profile"]
_37
},
_37
_37
"flex-layout.col#profile": {
_37
"children": [
_37
"affiliate-profile-title",
_37
"affiliate-profile-totalizer",
_37
"affiliate-profile-table"
_37
]
_37
},
_37
_37
}

store.affiliate-form


_10
{
_10
"store.affiliate-form": {
_10
"children": ["affiliate-form"]
_10
}
_10
}

By "default implementation," we mean that when you install the Affiliate app in your store, you're actually using the jsons above behind the scenes to build the new pages.

Therefore, in order to customize these pages, you should:

  1. Create a affiliates.jsonc, affiliates-profile.jsonc, or affiliates-form.jsonc file under store/blocks.
  2. Copy the code above, paste it into the new file, and change it as you wish.
  3. Deploy your changes.

Props

There a two specific component types with props that must be configured to work properly.

affiliate-validator and affiliate-profile-validator props

Prop nameTypeDescriptionDefault value
validstringSet the block name that will be rendered if the affiliate is validaffiliate-template
invalidstringSet the block name that will be rendered if the affiliate is invalidaffiliate-invalid-template

affiliate_url_monitoring props

Prop nameTypeDescriptionDefault value
parameterstringParameter name that will be used to validate the URL the affiliate sharedtargeting

Email Template

For the export function to work properly and be able to send the exported sheets to the user via email, it is needed to create two new templates on the message center, based on the examples below:

image image

Affiliate Orders Export Template


_105
<!DOCTYPE html>
_105
<html lang="pt-br">
_105
_105
<head>
_105
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
_105
<meta name="viewport" content="initial-scale=1.0">
_105
_105
<meta name="format-detection" content="telephone=no">
_105
_105
<title>{{_accountInfo.TradingName}}</title>
_105
<style type="text/css">
_105
p {
_105
font-family: Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
_105
};
_105
.vtex-button {
_105
border-width: .125rem;
_105
border-style: solid;
_105
font-weight: 500;
_105
vertical-align: middle;
_105
padding: 0;
_105
line-height: 1;
_105
border-radius: .25rem;
_105
min-height: 2.5rem;
_105
box-sizing: border-box;
_105
font-family: Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
_105
font-size: 1rem;
_105
text-transform: uppercase;
_105
letter-spacing: 0;
_105
background-color: #134cd8;
_105
border-color: #134cd8;
_105
color: #fff;
_105
cursor: pointer;
_105
};
_105
</style>
_105
</head>
_105
_105
<body marginwidth="0" marginheight="0" bgcolor="#fff" style="padding:0px 0px;color:#333;" leftmargin="0" topmargin="0">
_105
_105
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" align="left" valign="top">
_105
<tbody>
_105
<tr>
_105
<td align="center" valign="top">
_105
<table width="100%" style="max-width: 36rem;" align="center" cellpadding="0" cellspacing="0"
_105
border="0" valign="top">
_105
<tbody>
_105
<tr>
_105
<td>
_105
<div
_105
style="border:1px solid #e3e4e6;border-radius:8px;margin-top:1rem;margin-bottom:1rem;padding-top:3rem;padding-right:3rem;padding-bottom:3rem;padding-left:3rem">
_105
<img src="https://master--qamarketplace.myvtex.com/_v/public/assets/v1/published/vtex.messages-templates@0.1.12/public/react/cdbfb2a8b730a7ee840752d7af7ddc1c.png"
_105
width="77px" height="28px"
_105
style="display:block;outline:none;border:none;text-decoration:none"
_105
class="CToWUd" />
_105
<p style="font-size:24px;color:#25354d;margin-bottom:32px">
_105
<strong>Planilha de pedidos de afiliados exportada</strong></p>
_105
<p style="font-size:16px;color:#3f3f40;margin-bottom:32px">
_105
Olá,</p>
_105
<p style="font-size:16px;color:#3f3f40">
_105
Segue o link para baixar a planilha pedidos de afiliados.
_105
</p>
_105
<div style="margin-bottom: 24px">
_105
<a href="{{link}}" download>
_105
<button
_105
style="border-width: .125rem; border-style: solid; font-weight: 500; vertical-align: middle; padding: 0; line-height: 1; border-radius: .25rem; min-height: 2.5rem; box-sizing: border-box; font-family: Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif; font-size: 1rem; text-transform: uppercase; letter-spacing: 0; background-color: #134cd8; border-color: #134cd8; color: #fff; cursor: pointer;"
_105
type="button">
_105
<div style="display: flex; align-items: center; justify-content: center; height: 100%; padding-left: 1.5rem; padding-right: 1.5rem; padding-top: 0.25rem; padding-bottom: 0.25rem;">
_105
Baixar Planilha
_105
</div>
_105
</button>
_105
</a>
_105
</div>
_105
<p style="margin-bottom:4px;font-size:16px;color:#3f3f40">
_105
Abraços,</p>
_105
<p style="margin-top:0px;font-size:16px;color:#3f3f40">
_105
VTEX</p><br />
_105
<p style="font-size:12px;color:#727273;margin-bottom:0px">
_105
O link para download é válido por 24 horas. Após esse tempo, será necessário realizar a exportação novamente.
_105
</p>
_105
<div
_105
style="color:#e3e4e6;border-top:1px solid #e3e4e6;border-bottom:0px solid #e3e4e6;margin-bottom:2rem;margin-top:1rem">
_105
</div>
_105
<p style="font-size:12px;color:#727273;margin-bottom:0px">
_105
Esse email é enviado automaticamente e não recebe respostas.
_105
</p>
_105
<p style="font-size:12px;color:#727273;margin-top:.25rem;margin-bottom:0px">
_105
Precisa de ajuda? <a href="https://help.vtex.com/?locale=pt" alt="VTEX Help"
_105
style="font-weight:bold;color:#3F3F40">Fale Conosco</a>
_105
</p><br />
_105
<p style="font-size:12px;color:#727273;margin-bottom:0px">
_105
© VTEX Praia de Botafogo, 300, 3º Andar, Botafogo, Rio de Janeiro, RJ,
_105
22250-040
_105
</p>
_105
</div>
_105
</td>
_105
</tr>
_105
</tbody>
_105
</table>
_105
</td>
_105
</tr>
_105
</tbody>
_105
</table>
_105
_105
_105
</body>
_105
</html>

Commissions By Sku Export Template


_106
<!DOCTYPE html>
_106
<html lang="pt-br">
_106
_106
<head>
_106
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
_106
<meta name="viewport" content="initial-scale=1.0">
_106
_106
<meta name="format-detection" content="telephone=no">
_106
_106
<title>{{_accountInfo.TradingName}}</title>
_106
<style type="text/css">
_106
p {
_106
font-family: Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
_106
};
_106
.vtex-button {
_106
border-width: .125rem;
_106
border-style: solid;
_106
font-weight: 500;
_106
vertical-align: middle;
_106
padding: 0;
_106
line-height: 1;
_106
border-radius: .25rem;
_106
min-height: 2.5rem;
_106
box-sizing: border-box;
_106
font-family: Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
_106
font-size: 1rem;
_106
text-transform: uppercase;
_106
letter-spacing: 0;
_106
background-color: #134cd8;
_106
border-color: #134cd8;
_106
color: #fff;
_106
cursor: pointer;
_106
};
_106
</style>
_106
</head>
_106
_106
<body marginwidth="0" marginheight="0" bgcolor="#fff" style="padding:0px 0px;color:#333;" leftmargin="0" topmargin="0">
_106
_106
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" align="left" valign="top">
_106
<tbody>
_106
<tr>
_106
<td align="center" valign="top">
_106
<table width="100%" style="max-width: 36rem;" align="center" cellpadding="0" cellspacing="0"
_106
border="0" valign="top">
_106
<tbody>
_106
<tr>
_106
<td>
_106
<div
_106
style="border:1px solid #e3e4e6;border-radius:8px;margin-top:1rem;margin-bottom:1rem;padding-top:3rem;padding-right:3rem;padding-bottom:3rem;padding-left:3rem">
_106
<img src="https://master--qamarketplace.myvtex.com/_v/public/assets/v1/published/vtex.messages-templates@0.1.12/public/react/cdbfb2a8b730a7ee840752d7af7ddc1c.png"
_106
width="77px" height="28px"
_106
style="display:block;outline:none;border:none;text-decoration:none"
_106
class="CToWUd" />
_106
<p style="font-size:24px;color:#25354d;margin-bottom:32px">
_106
<strong>Planilha de comissionamento por SKU exportada</strong></p>
_106
<p style="font-size:16px;color:#3f3f40;margin-bottom:32px">
_106
Olá,</p>
_106
<p style="font-size:16px;color:#3f3f40">
_106
Segue o link para baixar a planilha de comissionamento por SKU.
_106
</p>
_106
<div style="margin-bottom: 24px">
_106
<a href="{{link}}" download>
_106
<button
_106
style="border-width: .125rem; border-style: solid; font-weight: 500; vertical-align: middle; padding: 0; line-height: 1; border-radius: .25rem; min-height: 2.5rem; box-sizing: border-box; font-family: Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif; font-size: 1rem; text-transform: uppercase; letter-spacing: 0; background-color: #134cd8; border-color: #134cd8; color: #fff; cursor: pointer;"
_106
type="button">
_106
<div style="display: flex; align-items: center; justify-content: center; height: 100%; padding-left: 1.5rem; padding-right: 1.5rem; padding-top: 0.25rem; padding-bottom: 0.25rem;">
_106
Baixar Planilha
_106
</div>
_106
</button>
_106
</a>
_106
</div>
_106
<p style="margin-bottom:4px;font-size:16px;color:#3f3f40">
_106
Abraços,</p>
_106
<p style="margin-top:0px;font-size:16px;color:#3f3f40">
_106
VTEX</p><br />
_106
<p style="font-size:12px;color:#727273;margin-bottom:0px">
_106
O link para download é válido por 24 horas. Após esse tempo, será necessário realizar a exportação novamente.
_106
</p>
_106
<div
_106
style="color:#e3e4e6;border-top:1px solid #e3e4e6;border-bottom:0px solid #e3e4e6;margin-bottom:2rem;margin-top:1rem">
_106
</div>
_106
<p style="font-size:12px;color:#727273;margin-bottom:0px">
_106
Esse email é enviado automaticamente e não recebe respostas.
_106
</p>
_106
<p style="font-size:12px;color:#727273;margin-top:.25rem;margin-bottom:0px">
_106
Precisa de ajuda? <a href="https://help.vtex.com/?locale=pt" alt="VTEX Help"
_106
style="font-weight:bold;color:#3F3F40">Fale Conosco</a>
_106
</p><br />
_106
<p style="font-size:12px;color:#727273;margin-bottom:0px">
_106
© VTEX Praia de Botafogo, 300, 3º Andar, Botafogo, Rio de Janeiro, RJ,
_106
22250-040
_106
</p>
_106
</div>
_106
</td>
_106
</tr>
_106
</tbody>
_106
</table>
_106
</td>
_106
</tr>
_106
</tbody>
_106
</table>
_106
_106
_106
</body>
_106
_106
</html>

Customization

In order to apply CSS customizations to this and other blocks, follow the instructions given in the recipe on Using CSS Handles for store customization.

CSS Handles
affiliateStoreName
affiliateProfileTitle
profileButtonContainer

Some app errors and their possible solution

https://www.notion.so/vtexhandbook/Errors-that-the-affiliate-app-may-present-128f8223cee9800a93e7f9a32ea99fba?pvs=4

See also
VTEX App Store
VTEX IO Apps
Was this helpful?