I have used Statistics Collector policy for getting a custom dimension in Analytics Custom Report.
But i am unable to see the custom dimension in Reports → Custom Report → Dimensions dropdown.
I am attaching the proxy i have used herewith.apiproxy-rev4-2016-04-20-1.zip
1 Like
Swapnil, are you a trial/developer user?
Yes. I am using Apigee trial account.
We have disabled custom variable analytics for trial users in order to implement a new feature. We will re-enable this capability in the near future. We will update on this forum when we re-enable. Hope this is alright. We can demonstrate this capability on a non-trial account if you would like to see.
2 Likes
I’ve seen quite a few questions regarding custom analytics in free orgs. Here’s how I solved it.
You can fake custom analytics using ExtractVariables to get the content you want into a variable (e.g. custom header value or body element) and then in your target post flow response set the target URL. Now create a analytics report that uses target URL, remember to note this “abuse” of target URL in your report comments.
I did this to get analytics on different backend targets being hit by a node.js based proxy. I set backend-system variable in a customer header in the node backend then assigned it to the target URL.
Here are the policies on the target post flow for convenience:
<ExtractVariables async="false" continueOnError="false" enabled="true" name="EV-backend-system">
<DisplayName>EV-backend-system</DisplayName>
<Properties/>
<!-- Set by Node.js app to track backend system, prefereably a "coded" value to not expose backend URLs -->
<Header name="X-Backend-System">
<Pattern ignoreCase="true">{backend-system}</Pattern>
</Header>
<Source clearPayload="false">response</Source>
<VariablePrefix/>
</ExtractVariables>
<Javascript async="false" continueOnError="false" enabled="true" timeLimit="200" name="JS-set-target-url">
<!-- Hack to use target url, available in regular analytics reports. -->
<DisplayName>JS-set target url</DisplayName>
<Properties/>
<ResourceURL>jsc://JS-set-target-url.js</ResourceURL>
</Javascript>
jsc://JS-set-target-url.js
var val = context.getVariable("backend-system");
// Needs to be a valid URL
context.setVariable("target.url", "http://" + val);
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-remove-backend-system">
<DisplayName>AM-remove backend system</DisplayName>
<Properties/>
<Set>
<Headers>
<!-- For debugging, to verify its set -->
<Header name="X-TargetURL">{target.url}</Header>
</Headers>
</Set>
<Remove>
<Headers>
<Header name="X-Backend-System"/>
</Headers>
</Remove>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
Perhaps, I should make this an article.
@spadmanabhan @Swapnil Raverkar
1 Like
@Kurt Kanaskie Cool! This is a good method.