Clarification on External conversion tracking script


I am very confused about the external conversion tracking script. According to the documentation It says, disable all the goals in the page you want have external tracking, and add the below script in your final page, where the conversion script is fired.

<script type="text/javascript"> 
  var _ubaq = _ubaq || [];
  _ubaq.push(['trackGoal', 'convert']);
  (function() {
  var ub_script = document.createElement('script');
  ub_script.type = 'text/javascript';
  ub_script.src = 
    ('https:' == document.location.protocol ? 'https://' : 'http://') + 
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(ub_script, s);
  }) ();

My question is, this is just a generic script, how is it identifying which page in my unbounce needs to be credited with a conversion?

Forget about which page, which account is to be credited here, the documentation does not explainn any of this?

What I want the conversion script to do.

I want to add a conversion in a specific page, when a user comes from here.


Hi @Fayaz_Ahmed_Aralikat,

The answer to your question is actually really simple and delicious :cookie:
(That’s an emoji for a cookie by the way)



I spent a long time figuring out the absolute best way to track conversions coming from UnBounce landing pages, whether the leads arise from Google Ads, Bing, Yahoo Gemini, etc. I have determined that for me the best way is through the use of Google Tag Manager. Conversion tracking is complex, but using GTM simplifies it somewhat. I use the GTM conversion linker and have Google Analytics fire on every page. Then, the conversion rules are through a REGEX firing rule. If you are using the simple form confirmation page, then the rule which would fire the conversion tracker on that page is just “page URL matches REGEX - ignore case” form_confirmation.html

For many of our pages we have moved to a form step plan in which we feed information from the main landing page conversion to a “formstep 2” page. Then, “formstep2” becomes the REGEX for that exact conversion.