GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - LeeviKopakkala/utm_source_extension: Universal utm_source script. Find all forms in a website and add utm_source tag as a hidden field. Compatible with Google Ads, Webflow, Wordpress

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
utm_source.js
utm_source.js
 
 
utm_source_inline.html
utm_source_inline.html
 
 

Repository files navigation

utm_source_extension

Universal JS script to find utm_source in website url, attach it to session and add as hidden field to all forms.

Features

  • Retain site visitor origin for the whole session duration.
  • Google Ads compatible
  • Customizable tag search

Usage

General usage

  1. Copy content of utm_source_inline.html.
  2. Paste it to end of site body tag.

Field utm_source is automatically attached to all forms within the page.

Webflow

  1. Copy content of utm_source_inline.html.
  2. Paste it to Project settings -> Custom Code -> Footer Code.

Wordpress

  1. Attach script to end of footer with:
add_action('wp_body_open', 'add_code_on_body_open');
function add_utm_source() {
    echo 'COPY CONTENT OF utm_source_inline.html';
}

Example:

<!--UTM_SOURCE CODE-->
<script>
const TAG = 'utm_source'

const params = new URLSearchParams(window.location.search);
const url = new URL(window.location.href)
const utm_source = sessionStorage.getItem(TAG)
if (!utm_source && params.get(TAG)) {
  sessionStorage.setItem(TAG, params.get(TAG))
  const session = sessionStorage.getItem(TAG)
  utm_source = params.get(TAG)
}
document.addEventListener("DOMContentLoaded", () => {
  const forms = document.forms
  for (let form of forms) {
    let input = document.createElement('input')
    input.setAttribute('name', TAG)
    input.setAttribute('value', utm_source)
    input.setAttribute('type', "hidden")
    form.appendChild(input)
  }
});
</script>
<!--UTM_SOURCE CODE END-->

Field utm_source is automatically attached to all forms within the page.

About

Universal utm_source script. Find all forms in a website and add utm_source tag as a hidden field. Compatible with Google Ads, Webflow, Wordpress

Topics

google-adsutm-sourcewebflowwordpress

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.