# Using existing events for conversion tracking

**URL:** <https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773>\
**Category:** Data collection and tags\
**Created:** [June 30, 2022, 8:26am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773 "2022-06-30T08:26:08Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [June 30, 2022, 8:26am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/1 "2022-06-30T08:26:08Z")

</div>

Hi,

we’ve been tracking the submission of formulars on our website with custom events (NOT set by Google Tag Manager) with category, action and label. These events are our conversions in Google Analytics right now. Here’s the link to one of our [products](https://www.riedle.de/papiertaschen-papiertragetaschen-papiertueten-bedrucken/tragetasche-aus-recyclingpapier-umweltfreundlich-fsc-papier-nature/). The event tracking is working the same on every product page.

Is it possible to use the same events for setting up conversions in PIWIK Pro? Unfortunately I wasn’t able to do so.

Thank you in advance!

Regards,  
Stephan

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 2, 2022, 10:24pm UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/2 "2022-07-02T22:24:31Z")

</div>

Hi,

Analytics → Goals → Add a goal

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/9441c481e11689d82058a7f7a7fe05c21591fe96.jpeg)

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 4, 2022, 5:34am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/3 "2022-07-04T05:34:49Z")

</div>

Thank you for your reply!

Unfortunately this hasn’t worked yet. I’ve tried it like this and it still doesn’t track my conversions.

These are the event options set on our website:  
Category: Formular  
Action: gesendet  
Label: RIEDLE Classic

And I’ve set up the Goal like this:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/579af1b59f33ca792cd6402651ad18fa2f703cae.png)

But it’s still not working.

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 4, 2022, 2:21pm UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/4 "2022-07-04T14:21:33Z")

</div>

Could you paste a screenshot from the standard custom events report? I’d like to confirm if the fields match.

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 5, 2022, 11:25am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/6 "2022-07-05T11:25:14Z")

</div>

In the custom events report I can only see java script errors as an event:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/5ce691880727b861506739b725ec0031b62c6a43.png)

It looks like PIWIK doesn’t get the fired events.  
In Google Analytics the events are counted:  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/ab90d518e3ecfb868fda2a79de18af23d0ab83b4.png)  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/2f815b57125d6bb622d4f23824be976050443501.png)

But I can’t find the problem why the events aren’t tracked in PIWIK.

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 5, 2022, 6:08pm UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/7 "2022-07-05T18:08:17Z")

</div>

How did you implement event tracking? What code/tag and trigger?

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 6, 2022, 11:44am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/8 "2022-07-06T11:44:16Z")

</div>

The event is triggered after the form has been sent.

That’s the code we’re using for Google:

```auto
gtag("event", "gesendet", {event_category: "Formular", event_label: "'.$gtag.'"});

```

We also have a code for an old Matomo version which we don’t use anymore. But the cold is still left on the website:

```auto
_paq.push(["trackEvent", "Formular", "gesendet", "'.$gtag.'"]);

```

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 6, 2022, 4:11pm UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/9 "2022-07-06T16:11:14Z")

</div>

This code should also work with Piwik PRO as long as you have the main part of Piwik PRO tag installed on the site as well.

What does happen if you enter this code directly in browser’s console? Can you see there any errors?

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 7, 2022, 6:55am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/10 "2022-07-07T06:55:50Z")

</div>

When I enter this code in the browser’s console I’ll get the following error:  
Uncaught SyntaxError: illegal character U+201C  
But for Google Analytics the event tracking is working, so there shouldn’t be any problem I guess?

Does the PIWIK Pro code has to be the first code after the tag? As I’ve seen that the agency that has coded the website has written it after another code in second place.

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 7, 2022, 10:45am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/11 "2022-07-07T10:45:46Z")

</div>

Maybe there’s something wrong with this `gtag` variable. Try to run this code:

```auto
_paq.push(["trackEvent", "Formular", "gesendet"]);

```

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 7, 2022, 12:18pm UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/12 "2022-07-07T12:18:07Z")

</div>

Problem is that without the gtag it’s not possible to track which form has been sent. Which is necessary for us.

After the from has been sent we have some kind of push message for the user:  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/1X/f2fc68f2c7613eaab5f9e737305dcf4d5bb9b8cb.png)

Maybe it’s possible to track this message as an event?

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 8, 2022, 9:41am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/13 "2022-07-08T09:41:16Z")

</div>

You can pass the `gtag` variable as event name, that’s not a problem (it’s the next param after event name which is set to `gesendet`). Most likely just something in your code wasn’t right and thus this variable caused some errors. So yes, you can even pass the name / text from this form.

Could you check in the browser’s console if this variable actually is defined and works? You can use `console.log(variablename);` to do that.

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 8, 2022, 10:13am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/14 "2022-07-08T10:13:30Z")

</div>

I’ll get “Uncaught ReferenceError: variablename is not defined” when I enter “console.log(variablename);” in my browser’s console.

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 8, 2022, 10:22am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/15 "2022-07-08T10:22:16Z")

</div>

I was more thinking about checking the gtag var. So, `console.log($gtag);`.

---

<div class="post-metadata">

**Author:** ![RIEDLE](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@RIEDLE](https://community.piwik.pro/u/RIEDLE)\
**Post date:** [July 8, 2022, 10:38am UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/16 "2022-07-08T10:38:12Z")

</div>

Same for this. I’ll get the following error:  
Uncaught ReferenceError: $gtag is not defined  
 debugger eval code:1

---

<div class="post-metadata">

**Author:** ![kuba](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/kuba/32/7_2.png) [@kuba](https://community.piwik.pro/u/kuba)\
**Post date:** [July 8, 2022, 1:09pm UTC](https://community.piwik.pro/t/using-existing-events-for-conversion-tracking/773/17 "2022-07-08T13:09:14Z")

</div>

Ok, so now we know why it doesn’t work 🙂 Is the GA code executed in some other part of the app that it works for the other event?
