A Piwik method to mimik dataLayer.get(“gtm.element”)

Hi all,

is there an already usable method to get read the title from a parent cta?
In Google I used this
to create

I am using this to get some more information of buttons used on an AD-landingpage. The names of the buttons are always the same so I read the headline of the passage.

For example:

Regards Martin

Piwik PRO creates dataLayer events that have “stg” instead of having “gtm” as the first part before the period, e.g., “stg.pageView”. In general most of these GTM events should have a similar structure to Piwik PRO ones (stg events). In your case we are going to be probably looking at the “stg.click” as this usually contains the “element” value. Here is an example:

Unfortunately, there is no dataLayer.get() method in Piwik PRO, so you would not be able to simply retrieve a value of the dataLayer element by it, but what you could do is:

  1. Use vanilla Java script to retrieve the value for element from the stg.click event and create a method that would work similarly to the dataLayer.get() method.

  2. Use Piwik PRO Tag Manager and create a dataLayer variable that retrieves the value that you would be interested in. The value will be updated with each click and you can use it in your trigger conditions to fire certain tags or simply use the value in your tags (custom event or custom code). Example: