Twitter: Universal Tag via DTM?

paulinab5551861

24-06-2019

Hi!

Thanks for any help with this. We're doing a migration from GTM to DTM but I'm not familiar with how to set up Twitter Universal Tags.

In GTM, we have a pixel that fires in the Order Confirmation Page.

Agency sent over this type of tag:

<!-- Twitter universal website tag code -->

<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','ABCD');

twq('track','PageView');

</script>

<!-- End Twitter universal website tag code -->

yet my predecessor set the tag in GTM as like below (on a PAGE LOAD RULE😞

1778868_pastedImage_0.png

Would anyone be able to help me on setting this type of pixel up? and/or clarifying how the best way to port this over to DTM could be?

Since rule ordering isn't available in DTM - wondering what the best method could be.

I'm thinking it's something along like:

<!-- Twitter universal website tag code -->

<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','ABCD');

twq('track','PageView')

twq('track','Purchase',

{

value: DigitalData.Revenue,

currency: 'CAD',

content_name: DigitalData.x,

num_items: DigitalData.Quantity,

content_type: .DigitalData.ProductQuantity,

});

}

Thanks in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

zaned72942122

09-07-2019

Ideally, you should already have an event based rule or a direct call rule setup for the order confirmation, where all of the data concerning the transaction is readable.  Price point, the list of products, shipping price, whatever...  

Assuming you already have such a rule setup this way, you would just add it as a third party script, just as you have it in your post.  If you want to keep the <script> tag, then use Sequential HTML on Bottom of Page, but I recommend using Sequential JavaScript loaded on Bottom of Page so your tag gets executed at the point all of the transaction information should be available.  Otherwise, you may risk sending the pixel through without the DigitalData values.

As long as DTM is setup properly on the page, then you could theoretically get away with using any kind of rule.  I highly discourage the use of page load rules for order confirmation tags, though.  An order confirmation is an event that should be treated delicately and independently as not to confuse it with just another page (or a refresh of the order confirmation page).  Just make sure you have the include in the <head> and the _satellite.pageBottom() call in its own <script> tag just above the </body> tag.