Custom dimensions doesn't track from iframe

Have issue with custom dimensions report in matomo dashboard. Have webpage, working inside iFrame. We using Google tag manager for trackEvents and custom HTML for setting up custom dimensions. Realtime dashboard works well and all of Events are tracking, but custom dimensions reports always shows “There is no data for this report.” until we start page without iFrame, is this by design behaviour?
We use Matomo cloud solution.

Any help appreciated!

How are you defining the Custom Dimension? Keep in mind that you have to define it before a tracking request (pageview, event, goal, siteSearch) takes place. The Custom Dimension does not trigger a server communication on its own.

I have used recommended article from FAQ and set up it in this way:

<script>
  var _paq = _paq || [];
  
_paq.push(['setCustomDimension', 1, '{{Campaign id}}']);
_paq.push(['setCustomDimension', 2, '{{Organization id}}']);
  
_paq.push(['trackEvent', 'Sharing', 'sharing: started', 'sharing: started', '{{Value}}']);
</script>

Without iFrame it works correctly. In Network tab of chrome.inspector custom dimensions also attached to every matomo request, triggered by Event with proper values.

Can you provide the URL where this is implemented?

We are making a PoC for choose analytic Provider for own product, all were tested on localhost and staging, unfortunately we have no public service deployed at moment. Can I provide some useful information or something else? We are really enjoyed Matomo, but custom dimensions is a corner feature for us

There are a lot of points of potential errors here. In general, I would do testing with plain text values to not risk an empty variable somewhere (tracking would not be the problem then). Secondly, the console offers a lot of valuable information on what the tracking code is doing.

Thank you for your answers and time, with variables we have no problems, example of query
Request URL:

we can see, that dimensions were attached with proper values. The most strange thing, that all events tracks in realtime dashboard, but not custom dimensions ¯_(ツ)_/¯

In the Visitor-Log, you only can see Scope visit Custom Dimensions at the left side of the profile. Action Dimensions can be seen, when you hover over an action, that had some Custom Dimensions attached.

In the report (Behaviour or Visitor), you can see the custom dimension report after it has been archived.

Please also make sure that your own requests to the server are not excluded. And just to make sure - you have set up the Custom Dimensions in Matomo correctly and activated them?

1 Like

Yes, all dimensions has been activated, my request not excluded.
Thank you, they really shows on hovered event, so it means that all is good! We were waited, that they will appear in Behaviour Tab. But then we try to fetch them via API endpoint and it contains only Archived items?

it contains only Archived items?

Yes, only archives will be fetched, when you request that custom dimension via API. Only the Live APIs are based on raw data (and therefore live), but less performant and they return mostly data that you don’t need. Best idea to activate the cronjob to run every 0,5h or every hour to archive all data serverside. But I think you’re using Matomo Cloud setup, so this should be already active.

1 Like