Triggering event on datalayer Event

Hi I create a datalayer event and attached it with a Tag. The tag is triggering when this event is matching the condition. But I am not able to see the this event at piwik portal.

Can you share your exact configuration? Did you check if the event is emitted via Tag Manager debugger?

Yes, i checked it via debugger. All entries are coming in there. I am attaching a screenshot, the underlined is the event created with datalayer. The js Code is pasted below.

var fz_PiwikDataLayer = window.fzPiwikDataLayer || ;
jQuery(document).click(function(){
fz_PiwikDataLayer.push(
{‘event’: ‘fz_click’,‘fz_page_name’: ‘home’},
);
console.log(fz_PiwikDataLayer);
});
piwik_screenshot

I created a trigger named “Test” it is datalayer event then i attached this trigger with the Tag “Piwik Pro”. The datalayer event is bind to click on document. The tag is triggering when click is happen on document. But i am not able to see any data at piwik portal.

Below is the url to see

http://acc.fitzme.nl/cz/

So far it looks ok. Can you share the exact trigger configuration and what tag code are you using to send data to the analytics module?

var fz_PiwikDataLayer = window.fzPiwikDataLayer || ;
jQuery(document).click(function(){
fz_PiwikDataLayer.push(
{‘event’: ‘fz_click’,‘fz_page_name’: ‘home’},
);
console.log(fz_PiwikDataLayer);
});

This is the code for the pushing of data.

Below is the analytic code, key part is changed.

(function(window, document, dataLayerName, id) {
window[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:"stg.start"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');
function stgCreateCookie(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toUTCString()}document.cookie=a+"="+b+d+"; path=/"}
var isStgDebug=(window.location.href.match("stg_debug")||document.cookie.match("stg_debug"))&&!window.location.href.match("stg_disable_debug");stgCreateCookie("stg_debug",isStgDebug?1:"",isStgDebug?14:-1);
var qP=[];dataLayerName!=="dataLayer"&&qP.push("data_layer_name="+dataLayerName),isStgDebug&&qP.push("stg_debug");var qPString=qP.length>0?("?"+qP.join("&")):"";
tags.async=!0,tags.src="https://fitzme.containers.piwik.pro/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts);
!function(a,n,i){a[n]=a[n]||{};for(var c=0;c<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=[].slice.call(arguments,0);"string"==typeof a[0]&&window[dataLayerName].push({event:n+"."+i+":"+a[0],parameters:[].slice.call(arguments,1)})}}(i[c])}(window,"ppms",["tm","cm"]);
})(window, document, 'fzPiwikDataLayer', '5f0e624f-7058a7755983');

Source of page
http://acc.fitzme.nl/cz/?lang=nl

Attached is the screenshot of the configuration


What do you want to achieve? Currently the datalayer event is connected to the default Piwik PRO tag, which does basically nothing, since you disabled also the page view tracking for this tag. If it’s about triggering an additional page view, please use the virtual page view tag type and set it up separately. If your goal is to track the click as event, use the custom event template.

It is not only about collecting the click. I want to setup full datalayer so that we can have more data with certain event like we collect for ecommerce stores. In starting i build it independently but at that time also i am not able to see any data. So i attached this to default PiwiK Pro tag to see if any data will come but result is same no data is coming. So for both scenario independent and attached no data is coming under reports. Even the event name is also not visible under custom events. Right now it is with click just to get familiar with the flow. Our plan is to add various scenarios in our application.

You default Piwik PRO tag has page view tracking disabled. That’s the reason you don’t see data.

You can uncheck it and then you should start seeing data. Keep in mind that data is available in realtime only in the tracker debugger (available from settings). Other reports update with around ~30mins delay.

The reason to turn off this setting is that if we turn it on then we are receiving 2 same entries for a page

I just explained why the testing tag wasn’t recording any data. You can set up a custom event or virtual page view to make sure that the trigger you’re testing are working.

what if i don’t attach datalayer event with the Tag and keep it complete independent. Will it work?
I also have to keep manual tracking off. I need to record data with datalayer event.

Yes, it will work since the Piwik PRO main library will be already loaded on page load (via the Piwik PRO tag).

okay, I will do this and will message you again if problem persists

HI,
I created a independent tag with custom event. I am receiving the data for the event. But the data i am pushing using datalayer is still not visible. The event is not visible nor the metadata. Could you help me with that how to integrate the datalayer event? I think it is better if i start form zero again

  1. You set up datalayer code
  2. You check if event is available in tag manager debugger (there you can check the event name and datalayer variables defined)
  3. Set up a tag that sends data
  4. Set up a dataLayer trigger

If that doesn’t work, then let me know which tag you were working on and I’ll check it directly on your website.

Hi,

I created a new Tag “FZ Test” as custom event and assigned datalayer event as trigger. The datalayer event fires on click(right now it is on document). The event is triggering on click, i am able to see the defined JS code and variables under event log. But in portal backend only data coming which is present in scrrenshot

image

It looks all fine. All the defined fields have been sent to the analytics backend and you can see it through tracker debugger. Are you missing something here?

image

Under datalayer Tab in screenshot you can see that i am trying to assign event name and also the variable “fz_page_name”. This code belongs to the datalayer event which is assigned as trigger to the Tag “FZ Test”. This event and variable is no where present in backend. I checked Tracker debugger, session log, custom events under report, custom variables under report.

Ok. To get that data, you have to define new datalayer variables within the Tag Manager and then use this variable instead of fixed values in your event definition. To access defined variables, you can use the (x) icon presented here:

I am trying to do this action " Add an event to a data layer" present in above link