mardi 15 septembre 2020

Using Javascript IF function to create Google Tag Manager Variable

I'm trying to create a custom variable in Google Tag Manager. I need it to show a 0 value when...

A customer purchases using a discount code which contains the words 'Gift Voucher'
AND
It generates negative revenue.

Else it should just appear standard revenue (there are times when negative revenue is needed, hence why it should only appear as 0 when a gift voucher is used)

Ive tried the following

function () { if ( = str.includes("Gift Voucher") && <0 ) {return 0; } else { return ; }}

But this is returning a undefined value

Is anyone able to help?

Aucun commentaire:

Enregistrer un commentaire