# Unable to get the campaign rotation in EmailSubscriber

**URL:** <https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556>\
**Category:** Development\
**Created:** [August 20, 2021, 10:29am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556 "2021-08-20T10:29:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![markmgc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/markmgc/32/433_2.png) [@markmgc](https://forum.mautic.org/u/markmgc)\
**Post date:** [August 20, 2021, 10:29am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/1 "2021-08-20T10:29:00Z")

</div>

I would like to add some unique user tokens to an email, depending on which instance of the campaign is started. Much like a form submission campaign trigger, but without the form. I think the rotation field in the database is essential for this.

So in order to do that, I can link my specific data in a separate entity to the campaign, lead and rotation. Listen for the `mautic.email_on_send` event, and add the required tokens. But I can’t use the rotation in my subscriber, because the rotation is unknown at this point. I think it would make sense for the event’s source field to include the rotation, but I’m not sure if I can just add it to the array without interfering with Mautic core functionality.

If this is the way to go, I can create a PR with the necessary changes, if I’m completely wrong, please let me know 🙂

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [April 25, 2022, 4:08pm UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/2 "2022-04-25T16:08:48Z")

</div>

Hello @markmgc and Welcome!

I’m not sure I understand your business use case.  
Can you explain and give us more context?

Pierre

---

<div class="post-metadata">

**Author:** ![markmgc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/markmgc/32/433_2.png) [@markmgc](https://forum.mautic.org/u/markmgc)\
**Post date:** [April 30, 2022, 12:22pm UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/3 "2022-04-30T12:22:29Z")

</div>

Hey @pierre_a.

I’m trying to achieve a transactional mail setup, in which the same template is being reused for an order confirmation. The confirmation should show a different image with every order, and I want to resend a reminder of the order after a week. I have to differentiate between 2 orders of the same user in the same period, which is why I think I need the rotation in the email\_on\_send event.

Do you think I need to approach this differently? Thanks for your time

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [May 16, 2022, 2:46pm UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/4 "2022-05-16T14:46:38Z")

</div>

Hello @markmgc,

Today Mautic is not designed to send transactional emails on its own.  
What you can do is create your emails outside of Mautic and send them using the Mautic API (please see [Mautic Developer Documentation](https://developer.mautic.org/#create-email)).

Pierre

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 16, 2022, 3:12pm UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/5 "2022-05-16T15:12:16Z")

</div>

Hello, we are doing this and also using similar approach with abandoned carts. Mautic is great in managing transactional emails with dynamic content.

Make custom fields for all dynamic data, or use json to store it in one field.  
Push in data via API  
Add the custom field token in the template emails even as image url or whatever data you need.  
You can use the Twig Templates plugin ([https://mtcextendee.com/marketplace/twig-templates-for-mautic/](https://mtcextendee.com/marketplace/twig-templates-for-mautic/)) to process complicated logics, parse through json, etc.

It’s working perfectly.

Let me know if you have more questions.  
Joey

---

<div class="post-metadata">

**Author:** ![markmgc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/markmgc/32/433_2.png) [@markmgc](https://forum.mautic.org/u/markmgc)\
**Post date:** [May 16, 2022, 5:52pm UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/6 "2022-05-16T17:52:13Z")

</div>

Thanks, I was trying to circumvent that pattern by having a custom token query my actual API for the current data, but it seems that’s not possible at the moment.

How do you know if an abandoned cart is still abandoned? Do you always synchronize all carts to mautic?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 18, 2022, 4:14am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/7 "2022-05-18T04:14:22Z")

</div>

What ecommerce app do you use?

---

<div class="post-metadata">

**Author:** ![markmgc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/markmgc/32/433_2.png) [@markmgc](https://forum.mautic.org/u/markmgc)\
**Post date:** [May 19, 2022, 8:47am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/8 "2022-05-19T08:47:17Z")

</div>

It’s not really an ecommerce system but it’s a laravel application. Integrating with that system shouldn’t be an issue at all. The issue I’m having is that a customer could have multiple orders at the same time and I need to distinguish between them (this is where it’s different from an abandoned cart I suppose, because you normally can’t have multiple carts).

I could create a workaround by accumulating all the orders and send out the reminder once, but that isn’t ideal. An ‘order’ is really a submission in an online contest, so I want to send a reminder after 1 week to have the users share their submission on social media.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 19, 2022, 10:08am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/9 "2022-05-19T10:08:11Z")

</div>

Here you have a one to many relation, where the new 4.3 update, the Custom Objects can help.  
It’s coming out next week, you can already check the beta version once you update Mautic.  
I can’t give you a full walkthrough, but I believe it could be a solution.  
I’ll create a video about custom objects soon, and post it here.  
Until then here are the docs:

> **[Custom objects — Acquia Product Documentation](https://docs.acquia.com/campaign-studio/settings/custom-objects/)**
>
> Custom objects

J

---

<div class="post-metadata">

**Author:** ![jcroldos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jcroldos/32/4531_2.png) [@jcroldos](https://forum.mautic.org/u/jcroldos)\
**Post date:** [May 19, 2022, 10:31am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/10 "2022-05-19T10:31:58Z")

</div>

Hi @joeyk . This gives Mautic a lot of power! I never used this option, and seems to be great! But pretty “techie”! 🙂

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 19, 2022, 10:34am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/11 "2022-05-19T10:34:21Z")

</div>

Yeah, it’s another concept we have to learn. But I think some examples will help us to wrap our head around it.

---

<div class="post-metadata">

**Author:** ![jcroldos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jcroldos/32/4531_2.png) [@jcroldos](https://forum.mautic.org/u/jcroldos)\
**Post date:** [May 19, 2022, 10:35am UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/12 "2022-05-19T10:35:42Z")

</div>

Ready for making a new course about this? Stil lenjoying the last i did about templates!!!

Rgds,  
Julio

---

<div class="post-metadata">

**Author:** ![markmgc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/markmgc/32/433_2.png) [@markmgc](https://forum.mautic.org/u/markmgc)\
**Post date:** [May 19, 2022, 2:06pm UTC](https://forum.mautic.org/t/unable-to-get-the-campaign-rotation-in-emailsubscriber/20556/13 "2022-05-19T14:06:31Z")

</div>

That does look like a direction to solve my issue, I’ll look into it, thanks @joeyk!
