Take an action every X count

artywah
Bronze Contributor
Bronze Contributor artywah

I need to send an email every time a customer spends an accumulated $100.

I have the connector for the email program set.

"LifetimeValue" is being added to a stored Number per visitor for every transaction.

A second number called "Spend100" is also tallying the total spend

What I need to do in order is:

  1. Tell the email program via the connector to send a specific email (I can do this bit)
  2. Take $100 off the "Spend100" value (if they had spent $125 then I want the $25 to remain)

Can someone advise how to do part 2?

7 REPLIES 7

Take an action every X count

Tealium Employee

Hi @artywah, have you tried using the "Increment or Decrement Number" enrichment and subtracting 100 from it?

Here is a screenshot from the UDH for your reference:

Tealium UDH 2019-02-12 17-43-10.png

Take an action every X count

artywah
Bronze Contributor
Bronze Contributor artywah

So I need to...

  • Increment the "Order value $100" number by the transaction amount
  • If "Order value $100" => 100 then add them to "spend 100" audience
  • Tell the connector that if they are in the "spend 100" audience send them an email
  • Remove them from the "spend 100" audience
  • Take 100 off the "Order value $100"

How do I ensure that these steps happen in the correct order?

 

Take an action every X count

Tealium Employee

Hi @artywah 

Can I ask a couple of questions to help you?

1. What do you want to happen if the user places an order for say $250?

2. What do you want to happen if the user places several orders in the same visit?

3. For your setup, would you be able to offload some of the logic to Tealium iQ (client-side)?

4. Is there a timeframe on the offer?  If the user spent $95 six months ago and is now spending $10, do you still want to trigger the offer?

Take an action every X count

artywah
Bronze Contributor
Bronze Contributor artywah

Hi Mark,

All very good questions!

  1. With the neature of the customer's business that's unlikely but could happen. In that case they would be sent the email, have $100 deducted, be eligable for another email so it's sent, have $100 deducted, etc. Yes this means customers could end up with multiple offer emails but it's the only way at this point in time.
  2. It's all about the spend - they can have 5 sales but it's the $ that matters
  3. Yes absolutely - we have TiQ
  4. The promotation will have a start date, but after that yes if it takes you months to spend $100 then that's fine

Take an action every X count

Tealium Employee

Hi @artywah 

UDH does not currently have the mathematical operators of Floor/Celing, Integer Division and Modulus/Remainder, which would be needed here to do this in pure UDH.  I encourage you to please submit a product idea to add those enrichments on the Number Attribute.

So since we can use iQ here, I'd suggest the following approach;

1. Make sure Data Layer Enrichment (DLE) is swtiched on for the collect tag, at least on the order confirmation page and the first page of a users session as well as when they log in.  You can selectively control this if you don't want to have it run on every page, but be sure that the visitors lifetime order value is coming back via DLE at the correct point.

2. Add a JS extension scoped to the collect tag, conditional on the order confirmation page, with this kind of code;

//get the current order lifetime value and work out how many integer multiples of 100 it is
var previous = b && b['va.metrics.5019'] ? b['va.metrics.5019'] : 0; var previous100 = Math.floor(previous/100);
//add on the current order value and again work out integer multiples of 100 it is var now = previous + (b.order_total || 0); var now100 = Math.floor(now/100);
//work out how many integer multiple boundaries we have crossed b.as_100_crossed = (now100 - previous100).toString();

You will need to replace 5019 with the ID of your visitor lifeitme order total number in AS.  You may also need to replace order_total with whatever the variable name is in your data layer for the current order value.

Now in UDH, you can add an event level number called "as_100_crossed" and this gives you for the current order, how many times the visitor has crossed the $100 threshold on this order value.

Make sure that either in your iQ publish settings that code minification is turned on, or else remove the comments yourself from the above code.

Take an action every X count

artywah
Bronze Contributor
Bronze Contributor artywah
Hi Mark

That won't work as not all transactions are online. We have offline transactions being fed into Tealium nightly.

Assuming this means we can't run a campaign this way, do you have any suggestions of how to do something similar without requiring the 'missing' math operators? (I'll submit a feature request for them, too)
Highlighted

Take an action every X count

Tealium Employee

Hi @artywah 

Ah, that's why I asked if you could offload the logic into iQ.

For pure UDH, you do have some options.

Assuming that you don't want to change your logic at all, and without the enhancements discussed above, there are some ways, for example;

total.png

100.png

200.png

300.png

Threshold.png

You'll see that with this approach, it is bounded.  You need to create the $100 bins manually, and the approach will eventually stop working because you can only create a finite number of them.  I created 3 in the example above.

The above approach is designed to trigger immediately on a threshold.  If you want to wait for the end of the visit to do so instead, then make the final boolean visit scoped, and remove the set false enrichment from it.

I will go now and create an internal product idea for you for the necessary enrichments, but you should also create your own public facing one.