How to add tw_sale_amount: 0 tw_order_quantity: 0 in a script

javascript

#1

I have code some thing like below

 <script>
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
// Insert Twitter Pixel ID and Standard Event data below
twq('init','ny8u7');
twq('track','PageView');
</script>

now from above script how can I add tw_sale_amount and tw_order_quantity?


#2

Hi @MjainMitesh! Thank you for your question.

In the “single-event website tag” these parameters were readily available, as they appeared in the javascript code that you were adding to your page, but now, in the “universal website tag”, which is the one you’re using, this is not so straightforward. I looked at the javascript code that Twitter loads on your page and I figured out how you can still add these parameters:

twq('track', 'PageView', {
    "value": 0, // this is the old tw_sale_amount
    "num_items": 0 // this is the old tw_order_quantity
});

So instead of twq('track','PageView'); you would write like above. And they will be sent to Twitter.

But please note that in Twitter’s javascript code, these are called legacy parameters, and so even though they are sent, I don’t know if they are actually taken into consideration by Twitter on their end. But I would assume they are, since there are two other parameters that you can set that are not actually sent to Twitter servers, and these two are sent. But someone from the Twitter Staff should confirm this.

Hope this helps! :slight_smile:


Firing custom conversion events
#3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.