close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Affiliate data logs with DataAssist

Thread began 9/16/2009 10:05 am by georgina_barrett_187762 | Last modified 9/24/2009 8:48 pm by Jimmy Wu | 1316 views | 8 replies |

georgina_barrett_187762

Affiliate data logs with DataAssist

I am creating an ecommerce site with an affiliate login. I have created the site and the affiliate log in. I can track orders placed by people coming from an affilate site by storing the url variable affilateID in a session and then storing it in the orders table. What I want to know though - is there a way of tracking how many people came to the site from an affiliate site - even if they didn't buy anything?

Sign in to reply to this post

Jimmy Wu

At the top of each page, you can have code that inserts into the table or increments a value in the table every time a page is accessed with that particular associate ID. This would keep track of the number of page views that a user accesses your pages through that particular associate ID.

Sign in to reply to this post

georgina_barrett_187762

Thank you - but being relatively new to php please could you give me an idea of the code I would need to do this or point me in the right direction to find out.

Sign in to reply to this post

georgina_barrett_187762

I have tried this
(database table is called Hits with 2 columns AffiliateID and Counter)

<?php require_once('Connections/mainconnect.php'); ?>
<?php
if (!@session_id()) {
session_start();
$AffiliateID = $_GET["AffiliateID"];
mysql_select_db($database_mainconnect, $mainconnect);
mysql_query("UPDATE Hits SET Counter = Counter+1 WHERE AffiliateID=$AffiliateID;");
header('Location: ' . $AffiliateID);
} else {
header('Location: '.$AffiliateID);
}
mssql_close($con);
?>

However when I load the page it automatically returns me to my homepage - I don't have any page access restricts on it.

Sign in to reply to this post

Jimmy Wu

You can set up the DataAssist server behavior: Single Record Insert to insert the value into the database if you like instead of hand coding the insert.

Set the trigger to before page load and leave the Go to as blank. Set the value to be inserted as the parameter value.

Sign in to reply to this post

georgina_barrett_187762

Thank you. I have created an insert record on page load and set the affiliate id field to <?php echo $_GET['site']; ?> so that everytime that page is loaded with ?site=.... in the url it will add a record.

It would be a lot better if I could use an increment value (to save database space) so each time someone arrives from a certain site it updates the number rather than adding a row. How would I do this can I do it from update record or would I need to hand code?

Sign in to reply to this post

Jimmy Wu

You can use the update server behavior to achieve the increment, you should not have to hand code the update.

Sign in to reply to this post

georgina_barrett_187762

Thank you. I have tried using the Update > Update Single Record behaviour. But what code would I need to put in the value field. I can insert 1 into the value but I don't know how to keep adding 1 everytime.

Sign in to reply to this post

Jimmy Wu

The value would be the name of the affiliate or affiliate ID as it is stored in the table. The key column would be the affiliate name or affiliate ID column depending on what you're passing into the URL parameter.

Before you can use the URL parameter in the server behavior, you will have to add it to the page bindings. You can do this by going to the Bindings panel and hitting the "+" button and selecting URL Variable. In the popup, enter the name of the url variable you are using and hit ok.

You will also have to get the current count for that affiliate. You can do this by adding a recordset and looping through until you get the correct value. Then store this in a variable and use this to update the value of the field.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...