How to pass a URL parameter to a tracking pixel


#1

Hey there!
If my form confirmation page URL is
https://passageiro.99taxis.com/promo?PHONE=11999988888

and a marketing-tracking pixel installed in the confirmation page is
script type=‘text/javascript’ src=“https://track.omguk.com/875369/transaction.asp?APPID=”"

Where the script parameter APPID needs to be populated with the URL parameter PHONE.

Is it possible? If so, how should I do it?


#2

This is easily done with Google Tag Manager by creating variables that capture the value of Q or Z.

Then the variable can be used as a parameter for a custom dimension for instance.

If you don’t have access to Google Analytics, you could use the following setup:

<script> 
// Grab parameters from URL
var searchParams = new URLSearchParams(document.location.search);
var qpQ = searchParams.get("Q");
var qpZ = searchParams.get("Z");
 
// Basic Google Universal Tracking Code
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 
  ga('create', 'UA-44081296-1', 'auto');
 
// Modify the page view call to use the values of Q and Z as values for custom dimensions 1 and 2
  ga('send', 'pageview',{
	'dimension1': qpQ,
	'dimension2': qpZ
  });
 
</script>

Don’t forget to define the necessary custom dimensions in your GA property first.

Thanks & Regards,
Techtiq Solutions