You are here

function crazyegg_get_account_path in Crazy Egg Integration 8

Build account path from account number/id, e.g: "1234567" => "0123/4567"

Return value

bool|string

2 calls to crazyegg_get_account_path()
crazyegg_library_info_build in ./crazyegg.module
Implements hook_library_info_build(). Includes Crazy Egg tracking script as a library (but doesn't insert it to the page yet)
crazyegg_page_attachments in ./crazyegg.module
Implements hook_page_attachments(). Checks all conditions and if they are met, injects Crazy Egg tracking script into the page

File

./crazyegg.module, line 92

Code

function crazyegg_get_account_path() {
  $account_id = \Drupal::config('crazyegg.settings')
    ->get('crazyegg_account_id');
  if (is_numeric($account_id)) {
    $account_path = str_pad($account_id, 8, '0', STR_PAD_LEFT);
    $account_path = substr($account_path, 0, 4) . '/' . substr($account_path, 4, 8);
    return $account_path;
  }
  return FALSE;
}