Develop a Piwik PRO destination for walker.js

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 :vulcan_salute:

  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)

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

1 Like

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

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.

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

I just read the note to use the Tag Manager instead of the javascript tracking client (Installation — Piwik PRO Analytics Suite 16.37 documentation)

So should I follow this guide here: Guides — Piwik PRO Analytics Suite 16.37 documentation

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.

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 directly. For _paq.push this should be a nice starting point: Installation — Piwik PRO Analytics Suite 16.37 documentation

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.

1 Like

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!

1 Like

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

best,
Markus

1 Like

Hey Markus, good to see you here! :slight_smile:

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

General config

{
  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

{
  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?

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

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 :nerd_face:

1 Like

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.