Skip to content

Instantly share code, notes, and snippets.

View jamesmills's full-sized avatar

James Mills jamesmills

View GitHub Profile
<div id="adverts-container"></div>

<script>
    (function() {
        const uniqueId = '274e687a-d809-43e3-b33e-acc2d78d03e1'; // Replace with your own placement ID
        const containerId = 'adverts-container'; // Replace if you used a different ID in the HTML

        const script = document.createElement('script');
 script.src = 'https://cdn.reallygreatads.com/script.min.js';
@jamesmills
jamesmills / save-url-parameters.js
Last active June 18, 2024 20:45
save-url-parameters.js
/*
1. You'll need to have have the AnyTrack tracking code on your site for this to work.
2. Place the first script in GTM or in head of your HTML template. Load on every page.
3. Add the second script in the HTML page where you would like the LeadByte form to load.
4. Make sure to update the form ID and the URL to match.
*/
<script>
var url = new URL(window.location.href);
var searchParams = url.searchParams;
<script>
AnyTrack(function() {
// generates the user client id
var at_click_id = AnyTrack('atclid');
var campaign = new Retreaver.Campaign({
campaign_key: '{{ $campaign['retreaverCampaignKey'] }}'
});
var tags = {
@jamesmills
jamesmills / anytrack_leadbyte_example.html
Last active October 13, 2023 06:32
Extracting the AnyTrack Click ID to append to the LeadByte Custom Form integration.
<script>
AnyTrack(function() {
// Extract atclid once AnyTrack script is loaded
var atclid = AnyTrack('atclid');
var c1 = "7 Facebook Ad Tips";
// Append AnyTrack Click ID to LeadByte form url
var url = new URL(window.location.href);
var search_params = url.searchParams;
search_params.set('atclid', atclid);
@jamesmills
jamesmills / mysql.php
Created July 7, 2023 12:11
Fill Gaps in Statistical Time Series - Date by the hour
$requests = DB::table('advert_requests as ar')
->select(DB::raw("date_format(ar.created_at, '%Y-%m-%d %H' ) AS grouped_hour, count(*) AS requests"))
->join('placements as p', 'p.id', '=', 'ar.placement_id')
->where('ar.created_at', '>=', $from)
->where('p.site_id', $site_id)
->groupBy('grouped_hour')
->get();
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class GenerateDropForeignKeyMigration extends Command
{
// Let's say you have a local package which you want to do some develoment on by including it in another project
/Users/jamesmills/Projects/Packages/larapex-charts
// You can use this one-liner to have composer install it from you local file system
composer config repositories.local '{"type": "path", "url": "/Users/jamesmills/Projects/Packages/larapex-charts"}' --file composer.json
// Which will add this to your composer.json file
"repositories": {
"local": {
"type": "path",
@jamesmills
jamesmills / TreewareCombined.md
Last active April 7, 2020 09:34
Treeware Combined

Treeware Treeware Treeware (Trees)

Licence

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

January 2020

Anupdated version of this can be found on our Treeware About Us Page.

Treeware Launch

We are proud to announce the launch of Treeware.

We have partnered up with Offset Earth, to plant trees & fund the world’s best climate crisis solutions. We chose Offset Earth because they operate transparently with a minimal service fee, which they use to spread the message through social marketing.