Solved

How to pass a URL parameter to a tracking pixel

  • 8 June 2017
  • 5 replies
  • 109 views

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?

icon

Best answer by julien_level 21 October 2020, 12:53

View original

5 replies

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

Hello,
I have something similar and i’m trying to find a solution.
When a visitor arrivers to the Landing page he will get a id number.
If persn submits the form the id number will pass to thank you pahe in the URL parametes.

In the thank you page there is a conversion pixel from 3rd party.

it’s with this sctucture
img src=“https://abc.def.co/pixel.php?service=1111&idoferta=514421&money=MONEY&transaction_id=id_number” width=“0” height=“0” border=“0” hspace=“0” vspace=“0”

It’s possible to pass the URL value parameter “id_number” to the pixel?

Thank you

Userlevel 5
Badge +4

Hello @toniomorais,

Yes it’s possible. Have a look at this thread i posted a few years ago : How to insert a value from the form into a javascript on the Confirmation dialog?

I was having the problem and found a solution 🙂

Thank you so much.

I will try it.

I will inform soon

image001.png

It was easy to implement and works.

Thank you

image001.png

Reply