How to trigger Goals for form thank you pop up

Can anybody tell me how to set up a goal to capture when a form is filled out and the thank you lightbox pops up to say thank you?

I am using unbounce and there is a place for me to put script into the head tag. But I don’t understand how to set it up.

Thank you,



You can trigger goals from Javascript:

It is basically just calling _paq.push(['trackGoal', 1]); if your goal id is 1.

Hi Lukas,

Thank you, but now I’m even more confused.

I’m guessing I place this snippet of code in the rest of the matomo code?

The goal ID of 1, how does the connection get made?




You don’t place the snippet in the rest as that way it would get executed on site load. You add it to the javascript function that gets executed when the pop up opens.

Hi Lukas,

Here is what I put in the code that goes on all the pages:

<script type="text/javascript">
  var _paq = _paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackGoal', 1]);    <<<--------- I added it here.
  (function() {
    var u="//";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '6']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
<noscript><p><img src="//" style="border:0;" alt="" /></p></noscript>

So now I am collecting conversion but it looks like I’m getting triple for each conversion.

How should I configure the back end when setting up a goal?

Question 2.

Are you saying I should just place this by itself like this below:

_paq.push([‘trackGoal’, 1]);

Into popup dialog, or do I add the whole tracking code?

Lukas thank you for you help!



This is what I did:

<script type="text/javascript">
_paq.push(['trackGoal', 3]);

Is that correct?