Hi Elena,
I’d start with deciding how they should be seen in Analytics:
My recommendation is a custom event with this scheme:
Custom Event Category: Free download assets
Custom Event Action: {{ Asset Name }}
Custom Event Name: {{ Asset position }}
To get such events I would set up a Custom Event Tag in Piwik PRO Tag Manager.
I’ll start with the trigger which I believe would be a click trigger with this condition:
Click Classes - contains - free-download-link
(As - if I understand correctly - this is a common class between All free download links and is not used by any other elements. If that’s not the case the condition should be set in such manner that will trigger every time a free downloadable element on page is clicked regardless of positioning)
Now let’s get back to the custom event dimenisons:
-
Category: this one is just a string “Free download asset” (or other string that matches your needs
-
Action: this one will require a new variable, I would recommend using here a Lookup table variable with this setup:
- Input variable: Click URL
- lookup table:
- input: [google drive link 1]; output: [asset name 1]
- input: [google drive link 2]; output: [asset name 2]
- …
-
Name: This one is the hardest one as I believe you do not specify the position inside of the element in any way. What I would do in such a case is look outside of the box, literally with the use of JavaScript method .closest you can look for Selector of parent element like the banner or paragraph. For that you will need a custom JS variable
function() {
if ({{ Click Element }}.closest('#banner')) {
return "banner"; // This will return banner whenever the clicked element is inside of a element with ID banner - change to suit your needs
}
if ({{ Click Element }}.closest('p')) {
return "paragraph"; // This will return paragraph whenever the clicked element is inside of a paragraph (<p></p>) element - change to suit your needs
}
return undefined;
}
And with all that you should be good to go.
When it comes to reporting as this is all based on custom event you have access to all custom event dimensions (e.g. the custom event action which contains the downloadable asset name which would allow for a report like in your first point and custom event name with data needed for the second point), all session dimensions and Page URL on which the event was triggered.
Please let me know if would like further clarification on any of the steps
Best,
Oliwer