Forum
Members app - track downloads
I have the app working as expected - so I was hesitant to open an issue, but have ran out of ideas. Searching the forum has not helped me solve this.
I need to be able to track which user downloaded a file. I planned on using a google analytics track event, but I am having trouble passing the members name value to the template im using to show the files for download.
This:
<p>Welcome back, <perch:member id="first_name" /></p>
does not work for me on any of the members pages.
I also tried this:
<?php
PerchSystem::set_var('lang', 'en');
perch_content_custom('My region', array(
'template'=>'template.html'
));
?>
<a href="/<perch:content id="lang" />/contact/">Contact Us</a>
But couldn't get that to work. Is this how I should be able to get it to work - using PerchSystem ?
Thanks in advance.
- Diagnostics report HEALTH CHECK
Perch is up to date PHP 5.5.20 is up to date MySQL 5.5.42 is up to date Image processing available SUMMARY INFORMATION
Perch: 2.8.4, PHP: 5.5.20, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.4), assets (2.8.4), categories (2.8.4), perch_blog (4.6), perch_forms (1.7), perch_mailchimp (2.0.1), perch_members (1.2) App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); include(PERCH_PATH.'/core/apps/categories/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_blog/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_forms/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_mailchimp/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_members/runtime.php'); ?> PERCH_LOGINPATH: /cms PERCH_PATH: /public_html/cms PERCH_CORE: /public_html/cms/core PERCH_RESFILEPATH: public_html/cms/resources Image manipulation: GD PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M Resource folder writeable: Yes HTTP_HOST: DOCUMENT_ROOT: /public_html/ REQUEST_URI: /cms/core/settings/diagnostics/ SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
- Download template:
<perch:repeater id="resources-row-1" label="Resources Row (8)" max="8">
<perch:before><div class="row"></perch:before>
<div class="two cols / resource">
<a class="resource__link" href="<perch:content id="file" type="file" label="File" order="5" bucket="secure" />" onClick="_gaq.push(['_trackEvent', 'Resources', 'Download', <perch:member id="first_name" /> ]);">
<div class="resource__icon">
<img src="<perch:content type="image" id="resource-icon" label="Icon" order="3" />" alt="<perch:content type="text" id="resource-name" />" />
</div><!-- /.resource__icon -->
<p class="resource__name"><perch:content type="text" id="resource-name" label="Resource Name" required="true" title="true" order="1" /></p><!-- /.resource__name -->
</a>
</div><!-- /.resource -->
<perch:after></div><!-- /.row --></perch:after>
</perch:repeater>
Do you have a
first_name
field for your members?Hi Drew
Yes I do.
I can't see why that wouldn't work.
Do the examples that come with the app work for you?
Hi Drew
I have uploaded the /members/ folder as it is when downloaded without any changes to here: https://www.mcmwebhosting.com/members/
Log in as drew@test.com and test as the password.
There are 2 welcome backs - the first welcome back is:
and the second welcome back, the one that works is the php code one:
Ok - all I need to know is if those are functioning as you expect.
The above code does not work in the index.php of the members section or within a template.
Ok. How can I help?
Well that's code that you provide in the example code in members app, so I'm guessing it should work. So I need help trying to work out why it doesn't work for me even when using the example code that ships with the Members app.
If you add debug to the page, what does it output?
DEBUG:
This all looks fine. I'm doing some work with the Members app currently, so I'll see what I can find.
Thanks Drew.
I have a workaround to my original issue of not being able to track user downloads, but if this:
worked, then it would make it a better solution than what I am using at the moment.
Thanks again