Private URL (Formatting, tips and tricks)

(1/3) PRIVATE URL URL OVERVIEW

Pro tip: We often actually recommend using our Private URL (or SQL) widget as much as possible instead of the Push API because they're much more flexible and offer many more benefits (e.g. you'll always have a backup copy of your data, users can't accidentally delete your data, you don't have to run crons, you can create other types of charts like number/pie/list/cohort, etc). You can also set the refresh rate for this widget (whereas Push API is every 5 minutes).  

Your script would just need to connect to the data source and output CSV data for Cyfe as you currently do per www.cyfe.com/custom.  Here's an example URL we use for demonstration purposes (same as the one above): www.cyfe.com/custom-example

You can then add the {date_start} and {date_end} merge tags to your Private URL (e.g. http://www.yourdomain.com/script?start_date={date_start}&end_date={date_end}).
 
The merge tags will be automatically replaced by the respective dates in YYYYMMDD format when your URL is loaded. You can use these tags to generate dynamic content that respects the dashboard date range feature.

So every time a user wants to view data for a specific date range, Cyfe will call your script with that date range in the URL so your script can output the appropriate data for THAT time period.
 

(2/3) DYNAMIC DATES/DATA & THE X-AXIS
And, the data itself with Private URL could be as dynamic as you like. The only thing to remember is that if you use the "Date" label for the first column of your data and pass in daily dates (e.g.YYYYMMDD) then your widgets will be in sync with your dashboard's date range and Cyfe will automatically calculate certain values in the widget header. 
 
If you use any other label for the first column of your data then Cyfe will simply create a chart for you, put the first column's data on the x-axis and the other columns on the y-axis.  Simple as that. 

For example, this would work just fine -- in this case, the X-axis would be the minutes BUT it wouldn't respect the date picker in the top right.  But with the Merge Tags in the URL above, you'd still be able to respect the date picker.  

Minute,Events
12:00 AM,56
12:01 AM,10

(3/3) SECURITY WITH PRIVATE URL
 
For additional security, you can lock down your private URL with a Custom Key, which is found in your Settings (https://app.cyfe.com/settings/dashboard/customkey).
 
 
That way the user never has to worry about the whole custom key aspect and copy/pasting it in two different places. It's one less step in the process. Also, allow them to reset the URLs with a click of a button in case the URLs are leaked accidentally.