Create a dynamic variable for price and order ID in Google Tag Manager

Hi! I do running a Woocommerce site and have the Google Tag Manager connected to the site. I need a script (see the script below) to be triggered at the thank-you-page. I did create a trigger and a Tag in Google Tag Manager. When the scrip trigger it does not trigger any variable for "Order Total" and "Order ID". Im not sure how to set up that in Google Tag Manager. Please help so the script trigger the data I need.


(function() {

function c(t){for(var n=[login to view URL]("; "),r=0;r<[login to view URL];r++)if(p=n[r].split("="),p[0]==t)return p[1];return ''}

adrecord = {

"programID": xxx,

"orderID": c('$order = wc_get_order( $order_id );'),

"orderValue": "{order_total}",

"trackID": c('trackID'),

"source": c('source')


var e=[login to view URL]('script'); e.src='[login to view URL]';

var s=[login to view URL]('script')[0]; [login to view URL](e);





Skills: Google Tag Management, WooCommerce

See more: data layer for analytics implementation, google tag manager access, how to create data layer variable in google tag manager, google tag manager custom event, data layer variable google analytics, google tag manager event tracking, google tag manager custom javascript, create google tag manager account, google tag manager domains, cross domain tracking google tag manager, google tag manager cross domain, magento google tag manager, set cross domain tracking google tag manager, google tag manager joomla, google tag manager javascript, google tag manager specialist, google tag manager click id, google tag manager id, adobe dynamic tag management vs google tag manager, dynamic remarketing google tag manager

About the Employer:
( 1 review ) Gothenburg, Sweden

Project ID: #24478793

Awarded to:


Hello, I can help you to do the trigger and then you can test on your website. Please ping me if you are interested. Thanks and regards. Ha Nguyen

$50 USD in 1 day
(4 Reviews)

3 freelancers are bidding on average $115 for this job


Hi, Hope you are doing well. I have an experience of 15 years working on projects of Google AdWord , Amazon PPC and Google Analytics, Google Tag manager, A/B Testing, Conversion Optimization, Mixpanel, Pikiwiki, Klip More

$155 USD in 1 day
(3 Reviews)

Greeting! My Name is Sadik Kamar and I am an expert in Google Analytic, Web Analytic,S E O, Google Adword & Google Tag Manager. Certified I would love to have the opportunity to discuss your project with you. I have 5 More

$140 USD in 1 day
(1 Review)