Choose a factorization $A \to B' \to B$ with $A \to B'$ finite and $\Spec(B) \to \Spec(B')$ an open immersion. Let $g_1, \ldots, g_n \in B'$ be elements such that $\Spec(B) = \bigcup D(g_i)$ as opens of $\Spec(B')$. Suppose that we can prove the existence of trace elements $\tau_i$ for the quasi-finite flat ring maps $A \to B_{g_i}$. Then for all $i, j$ the elements $\tau_i$ and $\tau_j$ map to trace elements of $\omega_{B_{g_ig_j}/A}$ by Lemma \ref{lemma-trace-base-change}. By uniqueness of trace elements (Lemma \ref{lemma-trace-unique}) they map to the same element. Hence the sheaf condition for the quasi-coherent module associated to $\omega_{B/A}$ (see Algebra, Lemma \ref{algebra-lemma-cover-module}) produces an element $\tau \in \omega_{B/A}$. Then $\tau$ is a trace element by Lemma \ref{lemma-glue-trace}. In this way we reduce to the case treated in the next paragraph. \medskip\noindent Assume we have $A \to B'$ finite and $g \in B'$ with $B = B'_g$ flat over $A$. It is our task to construct a trace element in $\omega_{B/A} = \Hom_A(B', A) \otimes_{B'} B$. Choose a resolution $F_1 \to F_0 \to B' \to 0$ of $B'$ by finite free $A$-modules $F_0$ and $F_1$. Then we have an exact sequence $$ 0 \to \Hom_A(B', A) \to F_0^\vee \to F_1^\vee $$ where $F_i^\vee = \Hom_A(F_i, A)$ is the dual finite free module. Similarly we have the exact sequence $$ 0 \to \Hom_A(B', B') \to F_0^\vee \otimes_A B' \to F_1^\vee \otimes_A B' $$ The idea of the construction of $\tau$ is to use the diagram $$ B' \xrightarrow{\mu} \Hom_A(B', B') \leftarrow \Hom_A(B', A) \otimes_A B' \xrightarrow{ev} A $$ where the first arrow sends $b' \in B'$ to the $A$-linear operator given by multiplication by $b'$ and the last arrow is the evaluation map. The problem is that the middle arrow, which sends $\lambda' \otimes b'$ to the map $b'' \mapsto \lambda'(b'')b'$, is not an isomorphism. If $B'$ is flat over $A$, the exact sequences above show that it is an isomorphism and the composition from left to right is the usual trace $\text{Trace}_{B'/A}$. In the general case, we consider the diagram $$ \xymatrix{ & \Hom_A(B', A) \otimes_A B' \ar[r] \ar[d] & \Hom_A(B', A) \otimes_A B'_g \ar[d] \\ B' \ar[r]_-\mu \ar@{..>}[rru] \ar@{..>}[ru]^\psi & \Hom_A(B', B') \ar[r] & \Ker(F_0^\vee \otimes_A B'_g \to F_1^\vee \otimes_A B'_g) } $$ By flatness of $A \to B'_g$ we see that the right vertical arrow is an isomorphism. Hence we obtain the unadorned dotted arrow. Since $B'_g = \colim \frac{1}{g^n}B'$, since colimits commute with tensor products, and since $B'$ is a finitely presented $A$-module we can find an $n \geq 0$ and a $B'$-linear (for right $B'$-module structure) map $\psi : B' \to \Hom_A(B', A) \otimes_A B'$ whose composition with the left vertical arrow is $g^n\mu$. Composing with $ev$ we obtain an element $ev \circ \psi \in \Hom_A(B', A)$. Then we set  $$ \tau = (ev \circ \psi) \otimes g^{-n} \in \Hom_A(B', A) \otimes_{B'} B'_g = \omega_{B'_g/A} = \omega_{B/A} $$ We omit the easy verification that this element does not depend on the choice of $n$ and $\psi$ above. \medskip\noindent Let us prove that $\tau$ as constructed in the previous paragraph has the desired property in a special case. Namely, say $B' = C' \times D'$ and $g = (f, h)$ where $A \to C'$ flat, $D'_h$ is flat, and $f$ is a unit in $C'$. To show: $\tau$ maps to $\text{Trace}_{C'/A}$ in $\omega_{C'/A}$. In this case we first choose $n_D$ and $\psi_D : D' \to \Hom_A(D', A) \otimes_A D'$ as above for the pair $(D', h)$ and we can let $\psi_C : C' \to \Hom_A(C', A) \otimes_A C' = \Hom_A(C', C')$ be the map seconding $c' \in C'$ to multiplication by $c'$. Then we take $n = n_D$ and $\psi = (f^{n_D} \psi_C, \psi_D)$ and the desired compatibility is clear because $\text{Trace}_{C'/A} = ev \circ \psi_C$ as remarked above. \medskip\noindent To prove the desired property in general, suppose given $A \to A_1$ with $A_1$ Noetherian and a product decomposition $B'_g \otimes_A A_1 = C \times D$ with $A_1 \to C$ finite. Set $B'_1 = B' \otimes_A A_1$. Then $\Spec(C) \to \Spec(B'_1)$ is an open immersion as $B'_g \otimes_A A_1 = (B'_1)_g$ and the image is closed as $B'_1 \to C$ is finite (since $A_1 \to C$ is finite). Thus $B'_1 = C \times D'$ and $D'_g = D$. We conclude that $B'_1 = C \times D'$ and $g$ over $A_1$ are as in the previous paragraph. Since formation of the displayed diagram above commutes with base change, the formation of $\tau$ commutes with the base change $A \to A_1$ (details omitted; use the resolution $F_1 \otimes_A A_1 \to F_0 \otimes_A A_1 \to B'_1 \to 0$ to see this). Thus the desired compatibility follows from the result of the previous paragraph.