• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

How to create an Affiliate or Referral link - that lasts?

jasmin

New Member
I have managed to create an affiliate link, that adds the referrer ID into the form.

BUT, if the visitor leaves the page and comes back, or even visits another page and comes back to the form, the referrer information IS LOST.

How can we create a way where the referrer info is remembered between page views and even visits?

I guess this can be done with Session information or cookies. However I don't have an idea how that would be implemented.

Is there any beautiful soul out there that has any idea how to make the referrer id last through sessions and browsing pages?

---
For those also interested in creating a referral link, I give away the code that I have managed to create so far here, that works if they fill in the form directly when visiting...

http://fabrikar.com/forums/index.ph...al-id-from-url-between-pages-and-forms.50830/
 
Just so I understand the flow ...

The affiliate link points to a Fabrik registration form, with the query string arg that you use for the element default. But it's possible the user may not submit the form at the point, and may browse other pages on the site, before coming back to the registration form.

In that case, something like this should work for the element default:

Code:
$app = JFactory::getApplication();
$session = JFactory::getSession();
$ref = $app->getString('ref', '');

if (empty($ref)) {
   // if no ref query string, get it from session, use something unique (not just 'ref')
   $ref = $session->get('fabrik.custom.ref', '');
}
else {
  // if ref in query string, store it in session in case they don't submit the form right away
   $session->set('fabrik.custom.ref', $ref);
}

return $ref;

-- hugh
 
I made a modification to your code and got it to work! :)

I isolated that problem was your line:
$ref = $app->getString('ref', '');

that made the whole site not render anymore, except these error messages:
0 Call to undefined method Joomla\CMS\Application\SiteApplication::getString()
0 Call to a member function getString() on null

So I placed my old code back instead of that line and then it worked perfectly:
$ref= $link->input->getString('ref');

Do you think it is totally ok?

Anyway, I can now visit other pages or even close the whole tab, and then come back to the site and magically, the Referrer ID is filled in the form!

Thank you very much for the help cheesegrits. You are genious! :)

---

But what about when the Session expires?

Can there be a cookie solution so if they come back weeks later and register, the REF is back again?
 
Oh, yeah, it should have been $app->input->getString().

You can use $list for the variable name if you want, but everywhere else in pretty much any code ever written for Joomla, you assign getApplication() to a variable called $app. Then later in the code when you see the $app variable, you know it's the application.

-- hugh
 
Ok. Thanks! :)

How about the last question? Any ideas there?

Q: What about when the Session expires?
Can there be a cookie solution so if they come back weeks later and register, the REF is back again?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top