Using existing events for conversion tracking

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. 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

Hi,

Analytics → Goals → Add a goal

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:

But it’s still not working.

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

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

It looks like PIWIK doesn’t get the fired events.
In Google Analytics the events are counted:
image
image

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

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

The event is triggered after the form has been sent.

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

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:

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

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?

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.

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

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

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

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

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.

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

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

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

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