Grothendieck ring of "varieties carrying a function" Fix a base ring $R$, and consider pairs $(X,f)$ where $X$ is a scheme
of finite type over $R$ and $f:X\to R$ is an $R$-valued algebraic (not
constructible!) function on $X$.
I want to consider a Grothendieck $R$-algebra of such pairs, where
if $X = Y \coprod Z$, then $[(X,f)] = [(Y,f|_Y)] + [(Z,f|_Z)]$,
but also $[(X,f+g)] = [(X,f)] + [(X,g)]$ and $[(X,rf)] = r[(X,f)]$.

Surely this is a standard extension of the usual notion of the
  Grothendieck ring of varieties (which only has $f=1$, and the first
  sort of relation)? If so, where can I read about it?

Maybe I'm misreading the motivic integration survey literature (by
K. Smith, and E. Looijenga), but it seems like they're insisting 
on constructible functions, not algebraic. 
Ordinarily when a construction like this isn't in the literature, I assume it's
because it has too many relations and is $0$, but if $R = {\mathbb Z}$ 
it seems to me that this ring has many functionals, like
$[(X,f)] \mapsto \sum_{x \in X_p} (f(x) \bmod p) \in {\mathbb Z}/p.$ (I don't
see an analogue of $[X] \mapsto$ the Euler characteristic $\chi(X_{\mathbb C})$.)
EDIT: One problem I see is that $({\mathbb A}^1, f(x)=x)$ is
isomorphic under translation to $({\mathbb A}^1, f(x)=x+1)$. So
$[({\mathbb A^1}, 1)] = [({\mathbb A}^1, (x+1)-x)]
= [({\mathbb A}^1, x+1)] -  [({\mathbb A}^1, x)] = 0$. Of course
this fits with point-counting $\bmod p$.
 A: I have just come across this question, and I have no idea if the OP still has any interest in it, but theories built out of pairs $(X, f)$ go under the name of "exponential motives", and there has been quite a lot of recent interest in developing and applying them. Two recent papers that come to mind, emphasising different aspects, are Motivic classes of Nakajima quiver varieties, https://arxiv.org/pdf/1603.03200.pdf, and Exponential motives http://javier.fresan.perso.math.cnrs.fr/expmot.pdf; these papers in turn have several further references. 
A: To answer your question is a bit difficult because anytime you sum elements of something built out of the grothendieck ring of varieties you are doing (or attempting to do) motivic integration. Pairs $\phi = (X, f)$ certainly already exist in the literature (well actually one should consider the tensor product). But, note that you want $f$ to be a function in $n\in \mathbb{Z}$. Thinking of $f$ being algebraic to your base doesn't add anything because that part can be moved over to the 1st factor in the tensor product via the characteristic function on the graph. In fact, I think it is generally accepted that $f$ should be a function $$f : X(K) \to \mathbb{Z}[\mathbb{L}, \mathbb{L}^{-1}, (\mathbb{L}^{i} -1)_{i\in\mathbb{N}}^{-1}]$$
where $K$ is a field, and $X(K)$ is definable in the three sorted language of Denef-Pas and where $X$ above lives over $S$ in some suitable sense (factors through some projection $S\times \mathbb{A}^{n}\rightarrow S$).
The reason to use the language denef-pas is so that when the summation of a function $\phi(s,n)$ over $n$ exists, then there is in fact a function of the form $I(\phi)$ which can legitimately be called its integral. In other words, the measure exists and generating series will become rational. 
Perhaps you already know of this article: http://arxiv.org/abs/math/0410203 which lays the foundation for both geometric and arithmetic integration and connects it partly to motivic integration over formal schemes. 
Personally, I think what might be interesting here is trying to develop something non-commutative by taking pairs (X,f) where f is an endomorphism of X. But, to get something non-commutative, you cannot just take an extension of the usual grothendieck ring of varieties -- the multiplicative structure on such pairs needs to correspond with composition of functions. 
