# Tracking lead (via GTM)

**URL:** <https://community.piwik.pro/t/tracking-lead-via-gtm/3453>\
**Category:** Data collection and tags\
**Created:** [January 9, 2024, 9:46am UTC](https://community.piwik.pro/t/tracking-lead-via-gtm/3453 "2024-01-09T09:46:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![olive](https://avatars.discourse-cdn.com/v4/letter/o/e9c0ed/32.png) [@olive](https://community.piwik.pro/u/olive)\
**Post date:** [January 9, 2024, 9:46am UTC](https://community.piwik.pro/t/tracking-lead-via-gtm/3453/1 "2024-01-09T09:46:20Z")

</div>

Hi,

I try to track custom events. But I’ve got error messages in dataLayer during validation test.

_“The method ‘generate\_lead’ was not found in “\_paq” variable. Please have a look at the Piwik tracker documentation”_

_“The method ‘job\_offer’ was not found in “\_paq” variable. Please have a look at the Piwik tracker documentation”_

I think I used the right framework in Google Tag Manager. I also tried with Piwik Tag Manager.

![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/9/9cef2aa2b154170935d0d9a915fbbe183e18651f.png)

Is there something I’m missing?

Have a great day,  
Olivier

---

<div class="post-metadata">

**Author:** ![anthonybartczak](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/anthonybartczak/32/2430_2.png) [@anthonybartczak](https://community.piwik.pro/u/anthonybartczak)\
**Post date:** [January 9, 2024, 9:53am UTC](https://community.piwik.pro/t/tracking-lead-via-gtm/3453/2 "2024-01-09T09:53:14Z")

</div>

Hi @olive,

Syntax for the custom event method is a bit different:

> **[API](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html#trackEvent)**
>
> The following API allows the user to: track page views, track visits on multiple domains and subdomains, track e-commerce events (successful orders, cart changes, product and category views), track...

It should look something like this:  
`_paq.push(["trackEvent", "generate_lead", "Lead", "domaine"]);`

---

<div class="post-metadata">

**Author:** ![olive](https://avatars.discourse-cdn.com/v4/letter/o/e9c0ed/32.png) [@olive](https://community.piwik.pro/u/olive)\
**Post date:** [January 9, 2024, 10:10am UTC](https://community.piwik.pro/t/tracking-lead-via-gtm/3453/3 "2024-01-09T10:10:03Z")

</div>

Hi Anthony,

Thanks! It seems better.

It should be like this, right?

![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/f/fd5c0b18474c0003c39e18c82a9849db7f213982.png)

Thank you so much.

Olivier

---

<div class="post-metadata">

**Author:** ![anthonybartczak](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/anthonybartczak/32/2430_2.png) [@anthonybartczak](https://community.piwik.pro/u/anthonybartczak)\
**Post date:** [January 9, 2024, 10:26am UTC](https://community.piwik.pro/t/tracking-lead-via-gtm/3453/4 "2024-01-09T10:26:47Z")

</div>

> [@olive](#):
>
> It should be like this, right?

Looks good. You can always use the tracker debugger to see whether any of the tracked events are being processed correctly.

> **[About the tracker debugger | Piwik PRO help center](https://help.piwik.pro/support/collecting-data/tracker-debugger/)**
>
> The tracker debugger is a tool that helps you check your website tracking. It displays information about visitor sessions and events that took place within the last six hours. If you’ve made changes to your tracking setup, you can use the tracker...

---

<div class="post-metadata">

**Author:** ![olive](https://avatars.discourse-cdn.com/v4/letter/o/e9c0ed/32.png) [@olive](https://community.piwik.pro/u/olive)\
**Post date:** [January 9, 2024, 12:59pm UTC](https://community.piwik.pro/t/tracking-lead-via-gtm/3453/5 "2024-01-09T12:59:19Z")

</div>

Thank you for your help @anthonybartczak
