So we want to track and create a custom report for this:
We have free download assets offered in our blog articles. We want to track:
how many times they’re clicked
on which page url this is happening AND
identify on which design element of a given article this is clicked (sometimes the free download asset is linked from different places inside the same blog post: eg: a banner, inside a paragraph in a normal sentence)
provide an identifiable name for such asset for the reports (eg: Employee Cost Calculator)
We’d like to have 2 reports:
An explorer table to see a ranking of most to least clicked assets (no matter on what design element of the blog post this asset is clicked from)
A report to check each downloadable asset: the page url where the click is happening and most importantly the design element, to compare which is link action is being mor effective)
Here’s a loom with a few questions regarding the triggers, and whether a variable is needed too (for the name of the asset)
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
Amazing HELP @Oliwer_Kaczmarek I’ll create the lookup table and we’ll see with the WP developer about the Custom Event Name → asset position. I’ll let you know if we were successful!
@Oliwer_Kaczmarek just a little update. Report: most downloaded assets that fetch data from the custom lookup table variable ({{Asset Name}}) seems to be working. That Asset Name variable is used as the Custom Event Action parameter in the Event Tag.