Highlighted

SiteCatalyst:How to set currency event for shipping cost - SOLVED

Bronze Contributor
Bronze Contributor

I've answered my own question, but thought I'd share for anyone else:

My initial question

I want to set shipping cost into event7 as a currency metric either in the format:

 s.events = "purchase,event7=5.00";

or in s.products 

e.g.

  s.products=";prod1;1;10.00,;prod2;2;12.00,;shipping;;;event7=5.00";

 

but am struggling to achieve this using eCommerce extension.

 

It either ends up appending to every product like this :

  s.products=";prod1;1;10.00;event7=5.00,;prod2;2;12.00;event7=5.00,;shipping;;;event7=5.00";

(which inflates the shipping cost recorded)

 

or it just sets event7 as a single success event like this:

  s.events = "purchase,event7";

(which doesn't record a cost value)

 

I've tried using JS extensions to overwrite s.products, s.events, utag_data.shipping_cost or _cship but to no avail.

 

Any ideas?   Do I have to use do_Plugins to achieve this?

 

My solution

Yep.  I had to use s_doPlugins in a custom Javascript extension.

Just had this code in there:

   s.usePlugins = true;
   function s_doPlugins(s) {
   if(s.events.indexOf("purchase")>-1){
      s.events+=",event7="+utag_data.shipping_cost;
   }
   s.plugins = ""
   }
   s.doPlugins = s_doPlugins; 

And set the scope to Pre-Loader and SiteCatalyst and ran it after the eCommerce extension.

3 REPLIES 3
Highlighted

SiteCatalyst:How to set currency event for shipping cost - SOLVED

Employee Emeritus

Great solution @aliskink. Thank you for sharing!

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.
Highlighted

SiteCatalyst:How to set currency event for shipping cost - SOLVED

Tealium Employee

Hi @aliskink,

Just so you know in the Adobe Analytics tag there is a function available to you.

u.addEvent(eventName <(string|array) of events>, data);

 This will append this event, along with anyothers that the tag has generated to the s.events string.

Hope this helps.

Adrian

Ask me anything Tealium related or Javascript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Highlighted

SiteCatalyst:How to set currency event for shipping cost - SOLVED

Bronze Contributor
Bronze Contributor

Cool, thanks Adrian!