Push a value as a download link


(Guy Forssman) #1

Hi There,

A website written in asp.net generate dynamically download buttons per choosen item.

<a class="button button-dl" href="javascript:__doPostBack('ctl00$ctl00$cphContent$cphContent$gvBasketitem$ctl04$ctl00','')" style="margin-top: 4px;"><img style="position: relative; top: 4px; right: 5px" src="/images/picto/download.png">Download</a>

It’s the -$ct104- part that changes in a dynamically way, I found a way to get the value behind this.

The question now is how can I push a value as a download link so I can view this in the piwik webpage?

Kind Regards
Guy Forssman


(Michael Gonera) #2

Hi @Forssound, I think this part of documentation should help you solve it: JavaScript Tracking Client: Integrate - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3


(Guy Forssman) #3

Thank you I had already a look at this info…
Helas I can’t see how this could help me…

The values I’m speaking about are always changing.
The value (276173 for example ) behind the link above is mostly something other .
another moment the same link will have value 275120 these numbers are chosen pictures.

So what I like to do is push the value 276173 and let piwik register it that somebody downloaded this picture.

I experimented with the customDimension …
so I did this…
_paq.push([‘setCustomDimension’, 1, ‘DownItem’]);

where DownItem has a value like 276173 depending on the chosen picture helas this isn’t working neither

I hope somebody can shed a light on this…
Regards Guy


(Michael Gonera) #4

Such a line:

_paq.push([‘setCustomDimension’, 1, ‘DownItem’]);

will provide “DownItem” string as a value. If you would have your identifier of “276173” in some variable like $downitem, you shall do:

_paq.push([‘setCustomDimension’, 1, $downitem]);

And such passing of a variable value will work for sure!


(Guy Forssman) #5

That didn’t work …
_paq.push([‘setCustomVariable’,1, “VisitorType”, member, “visit”]); old way WORKS
_paq.push([‘setCustomDimension’, 2, member]); new way WORKS

member gets a value Authenticated or Not authenticated if a cookie has a UID…


(Guy Forssman) #6

It seems after some experimentations I finnaly found a working _paq.push

_paq.push([‘setCustomDimension’, 1, item]);
_paq.push([‘trackLink’, “downloaded item”, “inside”, {dimension1: item}]);