Thursday, 27 April 2023

Modify Request Headers in Chrome

  • Install ModHeader extension in Chrome
  • Use that extension to set a header
  • Open developer tool, network tab
  • Visit a page
  • View request headers in developer tool
  • Make sure header sent indeed

Friday, 21 April 2023

docker compose

extra_hosts

Add hostname mappings. Function the same as the docker client --add-host parameter.

//example
extra_hosts:
  - "somehost:162.242.195.82"
  - "otherhost:50.31.209.229"

An entry with the ip address and hostname is created in /etc/hosts inside containers for this service

host.docker.internal

For docker for mac or window, it is docker host ip. However, for docker for Linux, need to add this in compose file

#For docker for Mac or Window, should not add this. Otherwise,
#host.docker.internal may not be host ip.  It is for Linux only
extra_hosts:
    - host.docker.internal:host-gateway

Sunday, 9 April 2023

Google Tag Management System

What is tag

Tag is a JS code snippet inserted into a web page to track user event. Meta pixel and Goggle ad are some example of tags

What problem we have if we use multiple tags in a web page

  • Will need to add a code snippet for every tag. For example, if we use five track tools from ten different company, we need to add 10 extra code snippets in different pages
  • If we want to change some thing such as account id, we need to go to every page to modify them

Google Tag Management System

Tag management system likes an container. You set up and update tags in the tag management system, and you only need one extra code snippent in a web page no matter how many tags you want to use. Google Tag Management System is one of these systems.

Use Google Tag Management System, and you can

  • Set up tags
  • Set up event rules

gtag.js

gtag.js is the JavaScript framework that is used to add Google tags directly to web pages. It can not add third party tags.

Here what we need is a tag id

// Google tag (gtag.js)
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'TAG_ID');
</script>

The Google tag lets you send data from your website to linked Google product destinations. By now only Google Ads accounts and web data streams in GA4 properties can be destinations.

You can use a single Google tag across your entire website and connect the tag ID to multiple destinations.

Shopify

Enable custom app development from the Shopify admin

Before you can create a custom app for your store, you need to enable custom app development. You need to be the store owner or a staff member with the Enable app development permission to enable custom app development.

  1. From your Shopify admin, click Settings
  2. Click Apps and sales channels.
  3. Click Develop apps.
  4. Click Allow custom app development.
  5. Read the warning and information provided, and then click Allow custom app development.

Create an app

  • create a app called my-test
  • click Config Admin API scopes
  • choose services app needs such as customer, draft order, order and fullfillement services
  • click save configuration
  • install app and copy admin api token: shpat_559dummydummy77e77437574