<?php

namespace App\Tracking;

use App\Facades\Settings;
use Illuminate\Contracts\Support\Arrayable;

class UserBackTracking implements Arrayable
{
    public function toArray()
    {
        $code = Settings::get('tracking-userback-token');
        return [
            [
                "body" => 'window.Userback = window.Userback || {};Userback.access_token = "' . $code . '";'
                . '(function(d) { var s = d.createElement("script");s.async = true;'
                . 's.src = "https://static.userback.io/widget/v1.js";(d.head || d.body).appendChild(s);})(document);',
                'data-consent' => 'analytical'
            ]
        ];
    }
}
