Magento / Adobe Commerce Integration Guide

This guide walks you through integrating Tajo with Magento Open Source or Adobe Commerce to unlock customer engagement, loyalty programs, and marketing automation capabilities.

Overview

The Tajo-Magento integration enables you to:

  • Sync customer data automatically from your Magento store
  • Track orders and products for personalized marketing
  • Run loyalty programs with points, tiers, and rewards
  • Automate marketing campaigns via Brevo (email, SMS, WhatsApp)
  • Support multi-website and multi-store configurations
  • Handle complex product catalogs with configurable products

Prerequisites

Before starting the integration, ensure you have:

  • Magento 2.4+ or Adobe Commerce (Cloud or On-Premise)
  • Tajo account with an active subscription
  • Brevo account (optional, for marketing automation)
  • Admin access to your Magento instance
  • Composer for dependency management
  • PHP 8.1+ with required extensions

Step 1: Install the Tajo Extension

Terminal window
# Add Tajo repository
composer config repositories.tajo composer https://packages.tajo.io
# Install the extension
composer require tajo/module-magento:^2.0
# Enable the module
bin/magento module:enable Tajo_Core Tajo_Sync Tajo_Loyalty
# Run setup
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Manual Installation

Terminal window
# Download and extract to app/code
mkdir -p app/code/Tajo
cd app/code/Tajo
wget https://downloads.tajo.io/magento/tajo-magento-latest.zip
unzip tajo-magento-latest.zip
# Enable and setup
bin/magento module:enable Tajo_Core Tajo_Sync Tajo_Loyalty
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Configuration

Navigate to Stores → Configuration → Tajo → General Settings:

<!-- app/etc/env.php or via Admin Panel -->
'tajo' => [
'api_key' => 'your_tajo_api_key',
'api_secret' => 'your_tajo_api_secret',
'environment' => 'production',
'debug_mode' => false
],
'brevo' => [
'api_key' => 'your_brevo_api_key'
]

Step 2: Configure Data Sync

Customer Sync Settings

Configure at Stores → Configuration → Tajo → Data Sync:

{
"sync_settings": {
"customers": {
"enabled": true,
"sync_frequency": "real-time",
"fields": [
"email",
"firstname",
"lastname",
"telephone",
"group_id",
"store_id",
"website_id",
"created_at",
"addresses",
"custom_attributes"
]
},
"orders": {
"enabled": true,
"sync_frequency": "real-time",
"include_items": true,
"include_shipping": true,
"include_payment": true
},
"products": {
"enabled": true,
"sync_frequency": "hourly",
"include_configurable": true,
"include_images": true,
"include_categories": true
}
}
}

Event Observers

Tajo observes these Magento events:

EventPurpose
customer_save_afterSync customer updates to Tajo & Brevo
customer_register_successSync new customers, award signup points
sales_order_place_afterTrack purchases, award loyalty points
sales_order_save_afterUpdate order status, trigger campaigns
checkout_cart_save_afterTrack cart for abandonment
catalog_product_save_afterKeep product catalog synced

Multi-Website Configuration

For multi-website Magento setups:

<?php
// di.xml - Configure per-website settings
namespace Tajo\Core\Model;
class WebsiteConfig
{
public function getConfigForWebsite($websiteId): array
{
return [
'api_key' => $this->scopeConfig->getValue(
'tajo/general/api_key',
ScopeInterface::SCOPE_WEBSITE,
$websiteId
),
'loyalty_program' => $this->scopeConfig->getValue(
'tajo/loyalty/program_id',
ScopeInterface::SCOPE_WEBSITE,
$websiteId
)
];
}
}

Initial Data Import

Import existing data via CLI:

Terminal window
# Import all customers
bin/magento tajo:sync:customers --all
# Import orders from last 90 days
bin/magento tajo:sync:orders --from="90 days ago"
# Import product catalog
bin/magento tajo:sync:products --all
# Full sync with progress bar
bin/magento tajo:sync:full --verbose

Or programmatically:

<?php
namespace Tajo\Sync\Console\Command;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Tajo\Core\Api\CustomerSyncInterface;
class SyncCustomersCommand extends Command
{
public function execute(InputInterface $input, OutputInterface $output)
{
$searchCriteria = $this->searchCriteriaBuilder->create();
$customers = $this->customerRepository->getList($searchCriteria);
foreach ($customers->getItems() as $customer) {
$this->customerSync->sync($customer);
$output->writeln("Synced: " . $customer->getEmail());
}
}
}

Step 3: Set Up Loyalty Program

Configure Points System

Configure at Stores → Configuration → Tajo → Loyalty:

<?php
// Loyalty configuration
$pointsConfig = [
// Points per currency unit spent
'purchase_points' => [
'enabled' => true,
'rate' => 1, // 1 point per $1
'rounding_mode' => 'floor',
'include_tax' => false,
'include_shipping' => false
],
// Bonus actions
'bonus_points' => [
'account_creation' => 100,
'first_purchase' => 200,
'review_submitted' => 50,
'referral_made' => 500,
'birthday_bonus' => 100,
'newsletter_signup' => 25,
'wishlist_share' => 15
],
// Customer group multipliers
'group_multipliers' => [
'General' => 1.0,
'Wholesale' => 0.5,
'Retailer' => 0.75,
'VIP' => 2.0
]
];

Loyalty Block in Templates

Add loyalty widgets to your theme:

<!-- In your .phtml template -->
<?php
/** @var \Tajo\Loyalty\Block\Customer\Points $block */
?>
<div class="tajo-loyalty-widget">
<h3><?= __('Your Rewards') ?></h3>
<div class="points-balance">
<span class="label"><?= __('Points Balance:') ?></span>
<span class="value"><?= $block->getPointsBalance() ?></span>
</div>
<div class="loyalty-tier">
<span class="label"><?= __('Your Tier:') ?></span>
<span class="value tier-<?= strtolower($block->getCurrentTier()) ?>">
<?= $block->getCurrentTier() ?>
</span>
</div>
<div class="points-to-next-tier">
<?= __('%1 points until %2', $block->getPointsToNextTier(), $block->getNextTier()) ?>
</div>
</div>

Loyalty Tiers

<?php
$loyaltyTiers = [
[
'name' => 'Bronze',
'min_points' => 0,
'customer_group' => 'General',
'benefits' => [
'1 point per $1 spent',
'Birthday bonus points',
'Member-only promotions'
]
],
[
'name' => 'Silver',
'min_points' => 1000,
'customer_group' => 'Silver Members',
'benefits' => [
'1.25x points multiplier',
'Free shipping on orders $50+',
'Early access to sales'
]
],
[
'name' => 'Gold',
'min_points' => 5000,
'customer_group' => 'Gold Members',
'benefits' => [
'1.5x points multiplier',
'Free shipping on all orders',
'Exclusive product access',
'Priority support'
]
],
[
'name' => 'Platinum',
'min_points' => 15000,
'customer_group' => 'VIP',
'benefits' => [
'2x points multiplier',
'Free express shipping',
'Personal shopper',
'Annual gift'
]
]
];

Rewards as Cart Price Rules

<?php
// Create reward as Magento cart price rule
namespace Tajo\Loyalty\Model\Reward;
class RewardGenerator
{
public function createRewardCoupon(
int $customerId,
string $rewardType,
float $value
): string {
$rule = $this->ruleFactory->create();
$rule->setName('Loyalty Reward - ' . $rewardType)
->setIsActive(true)
->setCustomerGroupIds([0, 1, 2, 3])
->setWebsiteIds([1])
->setCouponType(Rule::COUPON_TYPE_SPECIFIC)
->setUsesPerCoupon(1)
->setUsesPerCustomer(1)
->setSimpleAction($this->getActionType($rewardType))
->setDiscountAmount($value)
->setStopRulesProcessing(false);
$this->ruleRepository->save($rule);
// Generate unique coupon code
$coupon = $this->couponFactory->create();
$coupon->setRuleId($rule->getRuleId())
->setCode($this->generateCouponCode($customerId))
->setUsageLimit(1)
->setUsagePerCustomer(1)
->setType(Coupon::TYPE_GENERATED);
$this->couponRepository->save($coupon);
return $coupon->getCode();
}
}

Step 4: Abandoned Cart Recovery

Cart Tracking Observer

<?php
namespace Tajo\Sync\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class CartSaveObserver implements ObserverInterface
{
public function execute(Observer $observer)
{
/** @var \Magento\Quote\Model\Quote $quote */
$quote = $observer->getEvent()->getQuote();
if ($quote->getItemsCount() === 0) {
return;
}
$customerEmail = $quote->getCustomerEmail();
if (!$customerEmail) {
return;
}
$cartItems = [];
foreach ($quote->getAllVisibleItems() as $item) {
$cartItems[] = [
'productId' => $item->getProductId(),
'sku' => $item->getSku(),
'name' => $item->getName(),
'quantity' => $item->getQty(),
'price' => $item->getPrice(),
'rowTotal' => $item->getRowTotal(),
'image' => $this->getProductImage($item->getProduct())
];
}
$this->tajoApi->trackCart([
'email' => $customerEmail,
'quoteId' => $quote->getId(),
'items' => $cartItems,
'subtotal' => $quote->getSubtotal(),
'grandTotal' => $quote->getGrandTotal(),
'currency' => $quote->getQuoteCurrencyCode(),
'checkoutUrl' => $this->urlBuilder->getUrl('checkout')
]);
}
}

Recovery Email Templates

email_templates.xml
<template id="tajo_cart_recovery_1" label="Cart Recovery - First Reminder" file="Tajo_Sync::email/cart_recovery_1.html"/>
<template id="tajo_cart_recovery_2" label="Cart Recovery - With Discount" file="Tajo_Sync::email/cart_recovery_2.html"/>

Step 5: Marketing Automation

Customer Segments

<?php
// Create segments based on Magento data
$magentoSegments = [
// Purchase behavior
[
'name' => 'First-Time Buyers',
'conditions' => [
'orders_count' => 1
]
],
[
'name' => 'Repeat Customers',
'conditions' => [
'orders_count' => ['$gte' => 2]
]
],
[
'name' => 'High-Value Customers',
'conditions' => [
'lifetime_sales' => ['$gte' => 1000]
]
],
// Customer groups
[
'name' => 'Wholesale Customers',
'conditions' => [
'group_id' => 2 // Wholesale group
]
],
// Store/Website specific
[
'name' => 'US Store Customers',
'conditions' => [
'website_id' => 1
]
]
];

Order Event Automation

<?php
namespace Tajo\Sync\Observer;
class OrderPlaceAfterObserver implements ObserverInterface
{
public function execute(Observer $observer)
{
/** @var \Magento\Sales\Model\Order $order */
$order = $observer->getEvent()->getOrder();
$customer = $this->getCustomerData($order);
// Award loyalty points
$pointsEarned = $this->loyaltyCalculator->calculate($order, $customer);
$this->tajoApi->awardPoints($customer['id'], $pointsEarned, [
'reason' => 'purchase',
'orderId' => $order->getIncrementId()
]);
// Send to Brevo for campaigns
$this->brevoApi->trackEvent($customer['email'], 'order_placed', [
'order_id' => $order->getIncrementId(),
'order_total' => $order->getGrandTotal(),
'points_earned' => $pointsEarned,
'loyalty_tier' => $customer['loyaltyTier'],
'products' => $this->getOrderProducts($order),
'store_id' => $order->getStoreId()
]);
// Check for tier upgrade
$this->loyaltyService->checkTierUpgrade($customer['id']);
}
}

Step 6: Product Recommendations

Configure Recommendation Engine

<?php
$recommendationConfig = [
'algorithms' => [
[
'name' => 'frequently_bought_together',
'weight' => 0.3,
'source' => 'magento_related'
],
[
'name' => 'similar_products',
'weight' => 0.25,
'source' => 'category_based'
],
[
'name' => 'customer_also_viewed',
'weight' => 0.2,
'source' => 'reports_viewed'
],
[
'name' => 'upsell_products',
'weight' => 0.15,
'source' => 'magento_upsell'
],
[
'name' => 'personalized',
'weight' => 0.1,
'source' => 'tajo_ml'
]
],
'filters' => [
'exclude_purchased' => true,
'in_stock_only' => true,
'same_website' => true
]
];

Recommendation Widget

catalog_product_view.xml
<referenceContainer name="content.aside">
<block class="Tajo\Recommendations\Block\Product\Recommendations"
name="tajo.product.recommendations"
template="Tajo_Recommendations::product/recommendations.phtml">
<arguments>
<argument name="algorithm" xsi:type="string">frequently_bought_together</argument>
<argument name="limit" xsi:type="number">4</argument>
</arguments>
</block>
</referenceContainer>

Step 7: CLI Commands

Tajo provides these CLI commands:

Terminal window
# Sync commands
bin/magento tajo:sync:customers [--all] [--from="date"]
bin/magento tajo:sync:orders [--all] [--from="date"]
bin/magento tajo:sync:products [--all]
bin/magento tajo:sync:full
# Loyalty commands
bin/magento tajo:loyalty:recalculate [--customer-id=ID]
bin/magento tajo:loyalty:award --customer-id=ID --points=100 --reason="Manual"
bin/magento tajo:loyalty:tiers:update
# Debug commands
bin/magento tajo:test:connection
bin/magento tajo:debug:customer --email="[email protected]"

Troubleshooting

Common Issues

Extension Conflicts

Terminal window
# Check for conflicts
bin/magento module:status | grep -i tajo
bin/magento setup:db:status
# Clear caches
bin/magento cache:clean
bin/magento cache:flush
rm -rf generated/* var/cache/* var/page_cache/*

Sync Issues

<?php
// Enable debug logging
// In app/etc/env.php
'tajo' => [
'debug_mode' => true,
'log_level' => 'debug'
]
// Check logs
// var/log/tajo.log
// var/log/tajo_sync.log

Performance Optimization

di.xml
<?php
// Use async sync for large catalogs
<type name="Tajo\Sync\Model\Queue\Publisher">
<arguments>
<argument name="async" xsi:type="boolean">true</argument>
<argument name="batchSize" xsi:type="number">100</argument>
</arguments>
</type>

Next Steps

  1. Configure Brevo Integration for email/SMS campaigns
  2. Set Up Webhooks for real-time events
  3. Create Customer Segments for targeted marketing
  4. Build Email Templates for automated campaigns

Support

AI-assistent

Hallo! Stel me vragen over de documentatie.

Start gratis met Brevo