Category Archives: Code Advice & Examples

Site functionality coding considerations, syntax, & examples

Make Complete Backups of Default Code First (Crucial!)

Thoroughly Read This and Think Through It All in Your Head – Come to an Epiphany That You Will NO LONGER Take the Risk of Losing Hours, Days, Weeks, or Even Years of Hard Work Coding, Configuring, and Designing Your New Site When ShiftCode Has Made it So Easy for Us Site Admins to Perform Complete and Automated Backups!  It cannot be stressed enough that it is definitely necessary to make complete backups all the files that you have access to BEFORE you start tinkering (modifying any code or site template designs)

Though ShiftCode always has your back if you lose any of the default programming code or design template code you shouldn’t have to worry about having to ask anyone for the default files should you mess something up (which is surprisingly easy to do – even for professional coders and designers)  Not only is it embarrassing to ask (I’ve been in that situation quite a few times) but it has the potential to completely halt your site building process until your request is handled (yes, ShiftCode support is usually pretty prompt with such requests but you probably don’t want to be put in the position of awaiting a reply while you (or your designer and/or coder) is in the midst of the creative process)

Also note that as your site build out and customization starts to bloom and all through the entire creative process then it will be necessary to make backups of your customizations in code and design at various stages of the creative process.  Know that modifying web site script code is a very delicate process and only one simple mistake in the form of omitting or adding one single character or command in code can potentially bring your entire site down showing an error (though the error condition would be only temporary until you find and fix the error in code or you restore the file containing the erroneous code from a previous backup)


Resolve Now to Commit to Performing Regular Full Site Backups Well Into the Future:  (Yes, you can thank me sometime in the future for stressing the importance of regular full backups while also giving yourself a nice pat on the back just after that dreaded unrecoverable event happens (God forbid! – but YES they do happen to everyone at least once over time!) simple statistics predict data storage error and/or human error causing an unrecoverable failure at least once (though probably more) in the life of most all web sites (if it were not for your regular backups then you may have been instantly out-of-business should a hardware failure of a hard drive or other crucial data storage device (more common than you may think))

backup_your_site

Another point to make here is to remind you that you are dealing with other people’s money that they have earned on your site and they have the legitimate right to demand their money from you (even in the case of data loss) it’  I don’t need to remind you how even the most polite and kind (initially) people appear to be – if you start messing with their hard earned money people will get them to stand up, pay attention, and become very vocal if there is even the slightest hint that there is a discrepancy in their site account funds (even if it’s not your fault like a drive failure, database corruption, etc.) then you will instantly be put in an untenable position if your members claim you owe them yet you suddenly don’t have access to any recent records to competently dispute or award their claims (I’ve been there and done that and I can tell you that personally you feel like a complete idiot (all you had to do is make simple backups at least a week apart to still have some idea in what ballpark you owe specific people.


OK, Enough Talking About Doing It – Let Me Show You How and Let’s Back Everything Up Now!
 

Prepare a Folder on Your PC or Device to Receive These Extremely Important Backups:I’d suggest that you make the new backup folder somewhere within the ‘My Documents’ or ‘Documents’ folders (one should already be present on your machine.  The reason why I suggest placing all backup folders within the Windows document area is that I know that whatever backup application you may have running (or eventually purchase in the future) will undoubtedly default to including common default areas where important documents are stored.  So, when you initiate any type of backup of the files on your PC then chances are your crucial GPT site  backups will be included by default.

What should you name your web site backups folder?  This is an area where it simply comes down to your own preferences.  I, myself, always like to have the backup folder name SCREAM at you with folder names I’m notorious for such as ‘DO_NOT_DELETE_THIS FOLDER_EVER – IT_CONTAINS_CRUCIAL_WEB_SITE_BACKUPS! – or the like (lol)

Installing Google Analytics Tracking Code

The popular and totally free Google Analytics service facilitates a very helpful and detailed analysis of the traffic frequenting your site.  Below is how and where you place the provided tracking code for best results on your ShiftCode GPT site (via the template).

First, sign in (or register and sign in) to your Google Analytics account.  Choose ‘Admin’ from the top Google Analytics menu.  From the center ‘Property’ menu dropdown choose “Create new property” to reach an ‘Administration > New Property” page and fill in the blanks on that page in reference to your new GPT site thereby creating a new Google Analytics property for the new site (if you have difficulties in this step then contact Google in regard to supporting their product ‘Analytics’ and it’s outside the scope of this document to support products by other entities) Click ‘Get Tracking ID’ to continue.

The code we are interested is located in the box just under the statement ‘This is your tracking code. Copy and paste it into the code of every page you want to track’  We don’t really need to place this code into every page as that statement implies.  All we need to do is insert that code into the HEAD section of our main ShiftCode site template and it will automatically be included on every page on your site.

It’s recommended (by Google) that you place this tracking code in the HEAD section of your template just before the closing “</head>” tag (as the very last item within the HEAD section of the template)
Head Section of the ShiftCode Main Template
In the above view depicts locating the ‘Files & Templates navigational menu in the lower right corner of the ShiftCode GPT Admin Panel, selecting ‘Templates’, and then selecting the template (clicking on its name) that shows as the ‘Default’ template (the one that has a ‘Yes’ in the ‘Default’ column.

Notice the “</head>” statement in line nine (9) of the example image above.  That is the closing HEAD section statement where we want the Google Analytics tracking code to be inserted just before.  Note we want to INSERT the code NOT replace ANY code that’s already located in your template (if you have trouble with this then we suggest you investigate the very basic (completely newbie) use of the ‘Insert’ key on your computer keyboard which may just need to be toggled to not replace text but actually insert text)

Ok, copy the Google Analytics code to your Windows clipboard, click just before the “</head>” statement (wherever it may be on YOUR template), press <Enter> (or <Return>) on your computer keyboard to drop the “</head>” statement down a line (and make sure that you are inserting instead of replacing code), and paste (<CTRL><V>) the Google Analytics tracking code in the empty space above the “</head>” statement.

After Google Analytics Code is Inserted

Your template code should look somewhat like the above example.  I’ve left the inserted code highlighted in grey only for the purpose of example here.  Now click the ‘Upload Template’ button to save your modified site template code (towards the bottom on you template editing page in the ShiftCode Admin panel) and you are now completely done adding the Google Analytics code to your site – congratulations!

Note that it may take a few minutes to an hour or more for the tracking code to become responsive to Google Analytics due to the ShiftCode ‘cache’ delay (a normal thing)