# Develop a Piwik PRO destination for walker.js

**URL:** <https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721>\
**Category:** Data collection and tags\
**Created:** [March 3, 2023, 11:36am UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721 "2023-03-03T11:36:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://community.piwik.pro/u/alexander)\
**Post date:** [March 3, 2023, 11:36am UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/1 "2023-03-03T11:36:42Z")

</div>

I’m going to develop a full Piwik PRO implementation as a walker.js destination. People using walker.js should easily send data to Piwik Pro via the JavaScript Tracking Client.

If you have any recommendations about the best possible integration or want to share thoughts on how to pimp a setup, feel free to contribute here 🖖

1. basic setup
2. custom events
3. e-commerce
4. customizations
5. feedback & maintenance

I’m planning to use the tracker ([JavaScript Tracking Client — Piwik PRO Analytics Suite 16.37 documentation](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/index.html))

**Additional context**  
walker.js: [GitHub - elbwalker/walker.js: Simple & lightweight tracking implementation layer based on attributes](https://github.com/elbwalker/walker.js)  
Custom Destination: [Custom (create your own) - Walker.js docs](https://docs.elbwalker.com/destinations/custom)  
Development: [Add Piwik Pro destination · Issue #182 · elbwalker/walker.js · GitHub](https://github.com/elbwalker/walker.js/issues/182)

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [March 3, 2023, 12:16pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/2 "2023-03-03T12:16:55Z")

</div>

Hi. Really nice to see that you plan to work on a Piwik PRO destination 🙂

The integration itself can work in a similar way to GA. I see in the docs that there’s even a destination for GTM. What would be the point to set up something like that? Or is it just server-side GTM? Piwik PRO Tag Manager is really similar to GTM (client-side), that’s the reason why I’m asking.

When it comes to the plan it looks fine. I’d wait a bit with e-commerce, since we’re going to release new features and events in April/May.

---

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://community.piwik.pro/u/alexander)\
**Post date:** [March 3, 2023, 12:41pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/3 "2023-03-03T12:41:38Z")

</div>

Thanks a lot for your feedback. This works pretty well here 🥳

I just read the note to use the Tag Manager instead of the javascript tracking client ([Installation — Piwik PRO Analytics Suite 16.37 documentation](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/installation.html))

So should I follow this guide here: [Guides — Piwik PRO Analytics Suite 16.37 documentation](https://developers.piwik.pro/en/latest/data_collection/web/guides.html#installing-tracking-code)

Both are working with the `_paq.push`, right?

When it’s just a different init/loading part, people could choose to load Piwik Pro via Tag Manager (e.g. `tagManager: true`). What do you think?

Regarding e-commerce: Is there an open draft about the changes? We could release a new version with the new syntax if it’s not a huge deal.

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [March 3, 2023, 12:57pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/4 "2023-03-03T12:57:34Z")

</div>

Tag manager is recommended because it installs by default also our consent manager and makes further changes in configuration easier.

By reading the docs, I can see that walker.js is more a replacement for a client-side tag manager. You simply control all the events and triggering via HTML markup. If that’s right, you can simply use `_paq.push` or [our javascript API](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html#javascript-tracking-client-object) directly. For `_paq.push` this should be a nice starting point: [Installation — Piwik PRO Analytics Suite 16.37 documentation](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/installation.html#installing-tracking-code-via-code-snippet)

As for installation, I think it’s a good idea to install Piwik PRO Analytics via Piwik PRO Tag Manager by default (with an option to not use it at all). This gives the users full value (basic Analytics code and Consent Manager installed by default). When you use the Tag Manager, you can use `paq.push` to manually send events or change the tracking configuration as you go.

When it comes to e-commerce, we have new API contracts, but we need to wait a bit more to be able to share them publicly.

---

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://community.piwik.pro/u/alexander)\
**Post date:** [March 3, 2023, 4:28pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/5 "2023-03-03T16:28:08Z")

</div>

After reading a little bit, I’d prefer to create a separate destination for the Piwik Tag Manager. Otherwise there are too many overlaps and duplicate setting to control `linkTracking`, `pageview` or duplicate events.

I focus on the JavaScript Tracking client first. It’s also the same logic for Google with their Tag Manager and a separate GA4 destination.

I’ll keep you posted!

---

<div class="post-metadata">

**Author:** ![mbaersch](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mbaersch/32/35_2.png) [@mbaersch](https://community.piwik.pro/u/mbaersch)\
**Post date:** [March 3, 2023, 10:21pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/6 "2023-03-03T22:21:01Z")

</div>

Hi Alex,

+1 for a separate destination with the regular “Analytics only” JS code.

This will be most useful in a walker.js setup with multiple destinations.

Adding an additional destination for the full code including the Tag Manager (and Consent) can then feed the dataLayer with events just like the GTM one.

A mapping for consent would be great here as well but this might need some more thought than just writing down whatever comes to my mind… now that I think about all the stuff a Piwik PRO destination could be used for 😁.

best,  
Markus

---

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://community.piwik.pro/u/alexander)\
**Post date:** [March 5, 2023, 3:29pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/7 "2023-03-05T15:29:57Z")

</div>

Hey Markus, good to see you here! 🙂

That’s my plan for the first version of the destination right now:

General config

```auto
{
  appId: 'XXX-XXX-XXX-XXX-XXX', // Id of the site
  url: 'https://your_account_name.piwik.pro/', // Same address as the Piwik
  // linkTracking: false, // Disable download and outlink tracking
  // pageview: false, // Disable default pageview events
  // domains?: Array<string>; // List of internal domains (uses setDomains)
  // userId?: string; // key from the event like user.id that uses setUserId
}

```

And the custom config for each event will look like this

```auto
{
  name?: string; // key from event like data.title for trackCustom
  value?: string; // key from event like globals.cart_items for trackCustom
  dimension: {
    [id: number]: string; // keys for additional dimension mapping
  }
  goal?: string | number; // value of the goal id that triggers a trackGoal push
}

```

`_paq.push(["trackEvent", entity, action, custom.name, custom.value]);`

In the overall destination’s config one could also define dimensions that use `setCustomDimensionValue`.

For future versions:

- e-commerce support
- setUserIsAnonymous (requires hooks)
- disableCookies to disable all first-party cookies
- enableCookies to enable all first-party cookies

Feel free to join a brain dump session anytime. I bet you’ve seen plenty of Piwik Pro setups that can help to prioritize the destination’s features.

Best regards!

PS: Does the Tracker detect a pageview for SPAs by default or should I also add a custom pageview option that fires a `trackPageView`?

---

<div class="post-metadata">

**Author:** ![mbaersch](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/mbaersch/32/35_2.png) [@mbaersch](https://community.piwik.pro/u/mbaersch)\
**Post date:** [March 5, 2023, 5:17pm UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/8 "2023-03-05T17:17:16Z")

</div>

Hi Alex,

this would only send custom events in every case and no regular pageviews without a custom mapping, if I understand your plan correctly? If so, the result will not be able to feed all reports with data. Also a mapping with standard categories for outbound links or downloads would be helpful…?

best,  
Markus

---

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://community.piwik.pro/u/alexander)\
**Post date:** [March 6, 2023, 10:19am UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/9 "2023-03-06T10:19:17Z")

</div>

Hey,

I’d try to call the best method like `trackPageView` (always for the page view event), `trackEvent` (default), or `trackGoal` (if goal is set), and in later versions also `trackSiteSearch` (for search is true) as well as the new e-commerce setup.

This should capture the most setups, wouldn’t it?

Best regards

PS: I’ll add a new destination method `run` as well as `hooks` in the next walker.js version. This extend possibilities 10x 🤓

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [March 6, 2023, 10:50am UTC](https://community.piwik.pro/t/develop-a-piwik-pro-destination-for-walker-js/1721/10 "2023-03-06T10:50:18Z")

</div>

> [@alexander](#):
>
> PS: Does the Tracker detect a pageview for SPAs by default or should I also add a custom pageview option that fires a `trackPageView`?

It’s handled by the tag manager, so if you’re not installing it, virtual page views should be added via mentioned `trackPageView` with proper URL and title.
